vendredi 21 juillet 2017

Simple elif statement

I am using the code below and for some reason unknown to me the if or elif statement are not being triggered. Instead the else is being run each time even when a valid option is being entered by the user!!

Please help me!

def main():

name = input("What is your name?")

print("Hello", name)

choice = int

choice = 0

choice = input("Please choose a number from the following options: \n 1. Paper \n 2. Rock \n 3. Scissors")

print (choice)

if choice == 1:

        print ('You chose number 1')

elif choice == 2:

        print ('You chose number 2')

elif choice == 3:

        print ('You chose number 3')

else:

        print ('Invalid Entry Mush')

return ()

main()

Aucun commentaire:

Enregistrer un commentaire