我正在尝试为我的工作列表创建一个代码,目前我已经编写了以下代码:
list = [ ]
def Menu(choice):
print("""Menu:
1. View entire list
2. View one item
3. Reset list
4. Edit list
5. Quit
""")
choice = int(input("Please choose an option: "))
while True:
if choice == "1":
print (list)
Menu()
elif choice == "2":
oneItem = int(input('Please enter an item to view (1-5): '))
oneItem = oneItem - 1
oneView = list[(oneView)]
print (oneView)
Menu()
elif choice == "3":
list = [None]*6
Menu()
elif choice == "4":
def carryon():
for i in range(6):
add = input("Please enter a new item for the list: ")
list.append(add)
carryOn = input("Would you like to carry on? (y/n): ")
if carryOn == "y":
carryon()
else:
break
break
Menu()
在shell中运行代码时,菜单显示良好:
Menu:
1. View entire list
2. View one item
3. Reset list
4. Edit list
5. Quit
Please choose an option: 3
但后来就一片空白。我可以在静止状态下输入东西,但什么也没发生。即使我按下回车键,它也会继续。我使用python3.4(gui)
目前没有回答
相关问题 更多 >
编程相关推荐