Archived

This topic is now archived and is closed to further replies.

This program in python wont compile!!!!!!!!arggggg!!!!!!!!!

This topic is 5794 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This program in python wont compile! and its really gettin me steamed! here it is:
  
#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!!!!!!!!!!!!!

Share this post


Link to post
Share on other sites
  

#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 = 0.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 = 0.5*length(b+c)
print "The area is", area



This works for me...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites