I am trying to make this maths game have different equations each time using the random number generator. In addition to random numbers/equations being asked, I need the programme to solve and tell the player whether they get the question correct or incorrect as they go. I am having alot of trouble figuring out how to loop this while still having different random numbers used in the new equation each time.
I want an addition question to be asked 10 times but with different with random numbers (0 - 10) eg. the first equation will ask: 5 + 4, and the second equation will ask: 2 + 10 etc.
Here is the lines of coding:
if "Addition":
easygui.msgbox ("Please enter the correct answer to earn a point, there are 10 questions in this quiz")
for number in range(0,10):
PlayerAnswer = easygui.enterbox ("What is " +str(Figure1)+ " + " +str(Figure2)+ "?")
if PlayerAnswer ==(Figure1 + Figure2):
AdditionAnswers += 1
easygui.msgbox ("Correct! Your score is "+str(AdditionAnswers))
else:
AdditionAnswers += 0
IncorrectAnswers += 1
easygui.msgbox ("Sorry, incorrect! Your score is still "+str(AdditionAnswers))
print(AdditionAnswers) #To check if programme is calculating score correctly
print(IncorrectAnswers)
So far it is working, but it is repeating the same equation 10 times over. Any help would be super appreciated, so thankyou so soo much in advance! xx
Aucun commentaire:
Enregistrer un commentaire