mardi 28 mars 2017

How can I make a Python 3.x program allow the user control what the program does?

The program is supposed to do the described functions on the numbers given, but I get an error after I give the second number.

Any ideas on how I can improve on my code?

num1=int(input("Give me a number: "))
    num2=int(input("Give me another number: "))
    add=int(("For addition, press [1]."))
    time.sleep(2)
    sub=int(print("For subtraction, press [2]."))
    time.sleep(2)
    div=int(("For division, press [3]."))
    time.sleep(2)
    multi=int(("For multiplication, press [4]."))
    time.sleep(2)
    print("Please input an option and press [RETURN].")
    if input == 1:
        ans=num1+num2
    if input == 2:
        ans=num1+num2

Aucun commentaire:

Enregistrer un commentaire