# Iterate the elements of the menu for dish, values in ____.____(): # Print whether the dish must be served cold or ho

动态 未结 0 98
小小草
小小草 LV1 2023年9月23日 23:40 发表
Here's the completed code: ``` my_menu = { "samosas": {"price": 5, "temperature": "hot"}, "naan": {"price": 3, "temperature": "warm"}, "chicken tikka masala": {"price": 12, "temperature": "hot"} } # Iterate the elements of the menu for dish, values in my_menu.items(): # Print whether the dish must be served cold or hot print(f"{dish.title()} is best served {values['temperature']}.") ``` The `items()` method is used to iterate over the key-value pairs in the `my_menu` dictionary. The `dish` variable represents the name of the menu item, and the `values` variable represents its price and temperature. The f-string in the `print()` statement correctly formats the output to display whether each dish is best served hot or warm.
收藏(0)  分享
相关标签: 智能问答
问题没解决?让AI助手帮你作答 AI助手
0个回复
  • 消灭零回复