Это мой код функции (где, вероятно, происходит ошибка):
Код: Выделить всё
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\n")
if continue_prompt.upper() == "Y" or continue_prompt.upper() == "YES":
last_answer = answer
else:
break
Источник: https://stackoverflow.com/questions/781 ... uld-expect