python - If Statements To Find Area and Perimeter -
print "this find area or perimeter of rectangle " print "do want find area(a) or perimeter(p) of rectangle?" a= raw_input(" want find ") if raw_input = (a) 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 if raw_input = (p) 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
how can program code a
area , p
perimeter?
this odd, cannot check see if raw_input()
something. , also, ==
test equality, =
assign. here want:
print "this find area or perimeter of rectangle " 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
Comments
Post a Comment