I made this code:
import random
wish = "j"
max_multiplications = 10
while wish == "j":
multi = 0
right_answer = 0
while max_multiplications != multi:
randomint1 = random.randint(1, 10)
randomint2 = random.randint(1, 10)
print randomint1, "*", randomint2, "="
ik = float(raw_input ("Insert your answer "))
multi += 1
answer = randomint1 * randomint2
if ik == answer:
right_answer += 1
print "Correct!Good Job!"
else:
print "Wrong answer!"
else:
wish = raw_input("You want to try again? [j/e]")
But maybe someone can help me now. How can I put into the beginning ,that the user can choose how many multiplications he wants to solve(not 10) AND if the user inserts a wrong answer he can try again.
Thanks! :)