由于某种原因,这段脚本正在返回错误:“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