i want to make the multiplication table practice app but always else code isn't working even i give right answers and i want to make a loop that when i give wrong answers repeat the question for me. Heres my codes, thank you;
import random
a = random.randint(1,10)
b = random.randint(1,10)
answer = a * b
print(a,"x", b,"= ?")
userinput = input("Enter your asnwer= ")
while not userinput == answer:
print("Wrong, try again!")
asnwer = input("Enter your answer= ")
else:
print("Well done, you know it right!")
Aucun commentaire:
Enregistrer un commentaire