So anyway I am writing a program to get the area of a triangle.
This is what I have:
h = raw_input("Enter the height of the triangle: ")
w = raw_input("Enter the width of the triangle: ")
print w
print h
area = w * h
area = area/2
print area
After entering the height and width (and printing them out) it gives me this error:Traceback (most recent call last): File "C:\Python24\TRI Calculator", line 5, in -toplevel- area = (w * h) TypeError: can't multiply sequence by non-intI'm guessing my input is becoming a string and it doesn't like non strings...
If I set the H/W variables in the code it works fine.
Thanks in advanced and happy programming-
bbqroast


Sign In
Create Account


Back to top









