这是我迄今为止的职能守则(如果出现错误的话):
def showAddition():
print("You have selected: "Addition"")
while True:
last_answer = None
if last_answer:
next_num = int(input("Please input another number: "))
answer = calc.addNums(last_answer, next_num)
else:
num1 = int(input("Please enter your first number: "))
num2 = int(input("Please enter your second number: "))
answer = calc.addNums(num1, num2)
print(f Your answer is {answer} )
continue_prompt = input("Would you like to continue? Y/N
")
if continue_prompt.upper() == "Y" or continue_prompt.upper() == "YES":
last_answer = answer
else:
break
我正试图这样做,以便我能够立即进入另一个编号,在数字后增加数字,而不会失败。 然而,出于某种原因,这 lo只是重复。 即便我对“不”的继续迅速投入,它甚至没有中断。 “赞成”和“反对”都产生了完全相同的结果,而没有结果。