#print menu
print "Area Caculation Program"
print "-----------------------"
print
print "Select a shape"
print "1. Rectangle"
print "2. Circle"
print "3. Triangle"
print "4. Trapazoid"
shape = input()
#get area
if shape == 1:
print "Area of a Rectangle
print "---------------"
print
length = input("Please input length")
width = input("Please input width")
area = length*width
print "the area is", area
elif shape == 2
print "Area of a Circle
print "---------------"
print
radius = input("Please input the radius")
area = (3.14*radius)radius
print "The area is", area
elif shape == 3
print "Area of a Triangle"
print "------------------"
print
length = input("Please input length")
width = input("Please input width")
area = .5(length*width)
print "The area is", area
elif shape == 4
print "Area of a Trapazoid"
print "-------------------"
print
length = input("Please input length")
b = input("Please input the first width")
c = input("Please input the second width")
area = .5length(b+c)
print "The area is", area
PLEAse PlEASE help!!!!!!!!!!!!!
This program in python wont compile!!!!!!!!arggggg!!!!!!!!!
This program in python wont compile! and its really gettin me steamed!
here it is:
B00
#print menuprint "Area Caculation Program"print "-----------------------"printprint "Select a shape"print "1. Rectangle"print "2. Circle"print "3. Triangle"print "4. Trapazoid"shape = input()#get areaif shape == 1: print "Area of a Rectangle" print "---------------" print length = input("Please input length") width = input("Please input width") area = length*width print "the area is", areaelif shape == 2: print "Area of a Circle" print "---------------" print radius = input("Please input the radius") area = (3.14*radius)*radius print "The area is", areaelif shape == 3: print "Area of a Triangle" print "------------------" print length = input("Please input length") width = input("Please input width") area = 0.5*(length*width) print "The area is", areaelif shape == 4: print "Area of a Trapazoid" print "-------------------" print length = input("Please input length") b = input("Please input the first width") c = input("Please input the second width") area = 0.5*length(b+c) print "The area is", area
This works for me...
really? it wont work for me, it gives me this-
"SyntaxError: invalid syntax"
"SyntaxError: invalid syntax"
B00
In case you didnt notice - he added a couple of :''s that you missed out.
Any nested block needs a : on the preceding line.
Once there was a time when all people believed in God and the church ruled. This time is called the Dark Ages.
Any nested block needs a : on the preceding line.
Once there was a time when all people believed in God and the church ruled. This time is called the Dark Ages.
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement