我是 python 新手,这是我的代码,.lower 通常可以工作,但这次不行。
technical_dict = {
dict : 'stores a key/value pair',
list : 'stores a value at each index',
map : 'see dict',
set : 'stores unordered unique elements'
}
userInput = (input("What term would you like to lookup or type 'exit' to stop:"))
if userInput.lower() not in technical_dict:
print("Term does not exist in technical dictionary")
if userInput.lower() in technical_dict:
print(technical_dict[userInput.lower()])
while userInput.lower() != "exit":
userInput = input("What term would you like to lookup or type 'exit' to stop:")
if userInput.lower() in technical_dict:
print(technical_dict[userInput.lower()])
if userInput.lower() not in technical_dict:
print("Term does not exist in technical dictionary")
break
慕勒3428872
相关分类