【发布时间】:2013-08-08 15:39:05
【问题描述】:
如果值 > 10 或
import random
while True:
value = int(input("Enter the amount of questions would you like to answer: "))
if value == (1,10):
for i in range(value):
numb1 = random.randint(0, 12)
numb2 = random.randint(0, 12)
answer = numb1 * numb2
problem = input("What is " + str(numb1) + " * " + str(numb2) + "? ")
if int(problem) == answer:
print("You are Correct! Great Job!")
elif int(problem) > answer:
print("Incorrect, Your answer is too high!")
elif int(problem) < answer:
print("Incorrect, your answer is too low!")
else:
print(" Error, Please tpye a number 1-10 ")
【问题讨论】:
-
value不会等于元组(1, 10)。你的意思是1 <= value < 10?
标签: python function python-3.x range