編輯:這個問題是在我的Python學習過程的開始問。 Syntax Error
由pythons IDLE生產,沒有引用說明。當人們要求完整的錯誤時,這是造成問題和困惑的主要原因。while循環結束時的語法錯誤
我正在做一個簡單的筆記回憶程序。我不是100%確定爲什麼如果有人能夠協助,我會不斷收到語法錯誤。
注意:錯誤只是「語法錯誤」。沒有其他信息顯示該錯誤。
錯誤顯示在program = False
所在的程序代碼末尾。我不允許在印刷或其他東西后放置它嗎?
請記住,我對Python和編程一般都很陌生。所以如果你有解決方案,請解釋我做錯了什麼。
####################################################################################
''' Goal = quick access list of notes that I can add to or remove from as needed.'''
''' Note: this script is designed for python 3.2+ check converted elements '''
####################################################################################
notes = {
'ban': 'BAN: is the account number.',
'bdt': 'testing derp'
}
program = True
active = False
def note_finder(word):
while active == True:
print ('Type one of the following keywords','\n','ban','\n','test','\n','test2','\n', 'Or type exit to close')
choice2 = input('--> ').lower()
if choice2 == 'exit':
print ('Exiting Function')
active = False
program = True
elif choice2 in notes:
print (notes[choice2])
else:
print ("Not a Keyword")
while program == True:
print ('Type one of the following options:','\n','1','\n','2','\n','3')
choice1 = int(input('--> '))
if choice1 < 1 or choice1 > 3:
print ("Not an option")
else:
print (note_finder(input('--->'))
program = False
active = True
上一行有不匹配的圓括號。 – ForceBru
不確定爲什麼這個問題被拒絕投票。這是一個合理的問題。不像我要求某人爲我寫任何代碼。 –
只是FYI,包括問題中的* full *語法錯誤消息將幫助我們更輕鬆地幫助您!另外,錯誤信息甚至可以幫助你解決問題。 –