【发布时间】:2022-01-20 11:34:45
【问题描述】:
def interact():
while True:
try:
num = int(input("Please input an integer: "))
if (num % 2) == 0:
print ("{0} is even".format(num))
else:
print("{0} is odd".format(num))
num_two = int(input('Do you want to play again n/Y:'))
except:
if num_input == "y":
continue
finally:
print("Goodbye")
print(num_two)
【问题讨论】:
-
num_two根本不会是一个数字。
标签: python if-statement try-catch except finally