python - Perimeter of a quadrilateral and other shapes -


so today in science class thought of making python script basic perimeter of quadrilateral. later in future want expand circle , other shape got stuck in error. please help.

my code:

print ("this program find perimeter of quadrilateral. input length , breath , desired perimeter") len = input("what length?") bre = input("what breath?") length = len + len breath = bre + bre perimeter = length + breath print ("the perimeter of quadrilateral :" + perimeter) 

https://repl.it/xhg

and output comes funky. if l=2 , b=1 output comes 2211.

also, how expand different shapes? thinking of using if , else options if choice = circle execute circle code elif if choice = triangle execute triangle code. have better idea?

you need convert input int or float.

len = float(input("what length?")) 

in code

len = input("what length?") 

len string, , therefor when perform len + len performing string concatenation


Comments