-2
这是Python。Python:我的程序不能按照预期工作?
你好,我的程序运行完美,编译没有错误,但是当我运行下面的第二个选项时,它什么都不做。 '递归'函数将不会运行,并且它所打印的所有内容都是无限的“选择一个选项:”。我在某个地方缺少缩进还是忘了包含某些东西?
selection = 0
while selection != 3:
#This is printed out infinitely.
selection = int(input("Select an option: "))
#Second Option
elif selection == 2:
def recursion():
myString = str(input("Enter your string: "))
if not myString.replace('()', ''):
print("The string is even.")
else:
print("The string is not even.")
此代码不能运行;它在'elif'上给出了'SyntaxError:invalid syntax'。 – Blair