# Correct the mistake for key, value in my_menu(): # Correct the mistake print(f"The price of the {value} is {key}."

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