I would change the Code to (depending what Python Version you use!):
# Python 3.x:
import random
LIST = [1, 2, 3, 4, 5, 6, 7 ,8, 9]
streak = 0
number1 = random.choice(LIST)
number2 = random.choice(LIST)
right = int(number1 * number2)
print("Enter 0 to exit!")
svar = int(input(f"{number1} * {number2} is? "))
while svar != 0:
if svar == right:
streak += 1
print(f"Right!
Streak: {streak}")
else:
print(f"Wrong!
Streak ended @ {streak}")
streak = 0
number1 = random.choice(LIST)
number2 = random.choice(LIST)
right = int(number1 * number2)
svar = int(input(f"{number1} * {number2} is? "))
# Python 3.9:
import random
LIST = [1, 2, 3, 4, 5, 6, 7 ,8, 9]
streak = 0
number1 = random.choice(LIST)
number2 = random.choice(LIST)
right = int(number1 * number2)
print("Enter 0 to exit!")
while (svar := int(input(f"{number1} * {number2} is? "))) != 0:
if svar == right:
streak += 1
print(f"Right!
Streak: {streak}")
else:
print(f"Wrong!
Streak ended @ {streak}")
streak = 0
number1 = random.choice(LIST)
number2 = random.choice(LIST)
right = int(number1 * number2)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…