由於某種原因,這段腳本正在返回錯誤:「TypeError:字符串索引必須是整數」;我看不出有什麼問題。我是愚蠢的,忽略了一個明顯的錯誤嗎?我無法看到一個爲我的生活!Python - TypeError:字符串索引必須是整數
terms = {"ALU":"Arithmetic Logic Unit"}
term = input("Type in a term you wish to see: ")
if term in terms:
definition = term[terms]
sentence = term + " - " + definition
print(sentence)
else:
print("Term doesn't exist.")
耶穌基督,做我覺得愚蠢!謝謝大家指出我正確的方向。 – RoyalSwish