Anways, my code follows:
import random
rand1 = random.randint(0, 100)
rand2 = random.randint(0, 100)
answer = input(("What is " + str(rand1) + "+" + str(rand2)))
tanswer = rand1 + rand2
while int(answer) != int(tanswer):
print("Incorrect! Please try again.")
input(("What is " + str(rand1) + "+" + str(rand2)))
if int(answer) == int(tanswer):
print("Correct! Great job! Continuing...")
elif int(answer) == int(tanswer):
print("Correct! Great job! Continuing...")
2 problems:
1. In PyScripter, elif is incorrect syntax?
2. No matter what, even if I get the correct answer (after getting it wrong once) it continues to say it is incorrect.
What is wrong with my code?
-Cody

New Topic/Question
Reply




MultiQuote





|