0

how to make choices in python?

for example you want to code a calculator of + and multiply when you open the calculator it must ask you what do you want to calculate + or ×

4th Jun 2017, 9:20 PM
HASSAN AIT BIHI
2 odpowiedzi
+ 9
a=2 b=3 answer=input("enter + or * \n") if answer == "+": print(a+b) elif answer == "*": print(a*b) else: print("invalid")
4th Jun 2017, 11:13 PM
Ahri Fox
Ahri Fox - avatar
+ 1
if, elif and else statements
4th Jun 2017, 10:10 PM
Allan Stewart
Allan Stewart - avatar