python 2.7 - Why Does it say "Bad Input"? -
this question exact duplicate of:
print "this find area or perimeter of rectangle or triangle?" print "do want find area or perimeter of rectangle(r) or triangle(t)?" l= raw_input("i want find area or perimeter of ") if l=='r': print "do want find area(a) or perimeter(p) of rectangle?" a= raw_input(" want find ") if a=='p': print "what length of rectangle?" b = int(raw_input("the length of rectangle ")) print "what width of rectangle?" c = int(raw_input("the width of rectangle ")) d = (2 * b) + (2 * c) print d elif a=='a': print "got it. length of rectangle?" x = int(raw_input("the length of rectangle ")) print "what width of rectangle?" y = int(raw_input("the width of rectangle ")) z = x * y print z if l=='t': print "do want find area(a) or perimeter(p) of triangle?" m= raw_input("i want find " if m == 'a': print "what length of triangle?" n = int(raw_input("the length of triangle " print "what width of triangle? o = int(raw_input("the width of triagle " q = (n * o)/2 print q elif m=='p' print "what first length of triangle?" r = int(raw_input("the first length of triangle ") print "what second length of triangle?" s = int(raw_input("the second length of triangle ") print "what third length of triangle?" u = int(raw_input(" third length of triangle ") v = r + s + u print v
it says bad input on line stating if m=='a'
. please help.
you have a lot of missing brackets )
. must check match. every (
must have corresponding )
.
also, have :
missing, after if
or elif
conditions:
fixed:
print "this find area or perimeter of rectangle or triangle?" print "do want find area or perimeter of rectangle(r) or triangle(t)?" l = raw_input("i want find area or perimeter of ") if l == 'r': print "do want find area(a) or perimeter(p) of rectangle?" = raw_input(" want find ") if == 'p': print "what length of rectangle?" b = int(raw_input("the length of rectangle ")) print "what width of rectangle?" c = int(raw_input("the width of rectangle ")) d = (2 * b) + (2 * c) print d elif == 'a': print "got it. length of rectangle?" x = int(raw_input("the length of rectangle ")) print "what width of rectangle?" y = int(raw_input("the width of rectangle ")) z = x * y print z if l == 't': print "do want find area(a) or perimeter(p) of triangle?" m = raw_input("i want find ") if m == 'a': print "what length of triangle?" n = int(raw_input("the length of triangle ")) print "what width of triangle?" o = int(raw_input("the width of triagle ")) q = (n * o) / 2 print q elif m == 'p': print "what first length of triangle?" r = int(raw_input("the first length of triangle ")) print "what second length of triangle?" s = int(raw_input("the second length of triangle ")) print "what third length of triangle?" u = int(raw_input(" third length of triangle ")) v = r + s + u print v
Comments
Post a Comment