class Math_game_random:
def __init__(self,diffculty,amt_problems):
self.diffculty = diffculty
self.amt_problems = amt_problems
math_games_list = [Math_game.division_game(diffculty,1),Math_game.addition_game(diffculty,1),Math_game.multiplication_game(diffculty, 1)]
for i in range(amt_problems+1):
random.choice(math_games_list)
So for exampleI want to output to the player 6 randomly selected math problems:
amount_of_problems = 6
Math_game_random(1, amount_of_problems)
print(f"amount of correct: {correct}")
print(f"amount of incorrect: {incorrect}")
But for some reason after the first three problems are solved it doesn't continues to print out the next remaining 3 problems
My current output that I want to change:
9 / 1 = ?
>>>9
Correct answer!
20 + 12 = ?
>>>32
Correct answer!
8 * 9 = ?
>>>72
Correct answer!
amount of correct answers: 3
amount of incorrect answers: 0
Why is this occurring? Is it because once random.choice() have iterated through all of the elements in a list. Will it just stop, and if so. How can I work around this?
Aucun commentaire:
Enregistrer un commentaire