我試圖創建一個顯示你一組選項做更改列表清單。 但它不工作誰能告訴我什麼是錯的吧。創建一個簡單的Python菜單
menulist=("1. Print the list",
"2. Add a name to the list",
"3. Remove a name from the list",
"4. Change an item in the list",
"9. Quit")
list=("johny","tom","kim","tim","jim")
target=input("Pick an item from the menu:")
while (target in list):
if target="1"
print list
elif target="2"
Addname=input("Type in a name to add:")
list=list.insert(Addname)
print menulist()
elif target="3"
Removename=input("What name would you like to remove:")
list=list.remove(Removename)
print menulist()
elif target="4"
Changename=input(What name would you like to change:")
changetoname=input("What is the new name:")
list=list.replace('Changename','changetoname')
print menulist()
elif target="9"
print"good bye"
你有沒有開放「在'elif的目標=」 4" '分支 – akluth 2013-04-23 16:59:49
你有各種各樣的語法錯誤,比如沒有':'條件語句後,您使用的賦值運算符('= ')當你想比較(''==),等等。你或許應該入門書到Python – 2013-04-23 17:00:16
開始在Python? – 2013-04-23 17:02:19