我目前正忙于为python编写代码。我必须做一个10个单词的python字典,应该提示用户搜索一个单词,程序会搜索这个单词,如果找到匹配的,显示定义。我已经得到了足够的信息,但是我还不能确定是要使用elif,还是为了什么。我需要使用循环,但我卡住了。整天都在这上面。这是我写的代码。
# 1. The user should be prompted for a word to search for.
# 2. The program will then search for the term, and if a match is found, display
# the definition.
# 2. You should demonstrate the following concepts: dictionaries, loops, decision logic, user input, and other concepts you feel are necessary.
x = {"Milwaukee": "Bucks", "Oklahoma": "Thunder" , "Portland": "Trailblazers", "Miami": "Heat" , "Boston" : "Celtics", "New York" : "Knicks" , "Orlando" : "Magic" , "Houston" : "Rockets" , "Chicago" : "Bulls" , "Indiana" : "Pacers"}
team = input("enter team:")