QUESTION IMAGE
Question
activity 3 5 1 dictionary basics jump to level 1 dictionary food_quantity_pairs contains two key - value pairs, each representing a food name and the quantity ordered. output the quantity corresponding to key_name. click here for example 1 food_quantity_pairs = {\peaches\: 52, \milkshakes\: 29} 2 3 key_name = input() 4 5 print(key_name, \is:\) 6 7 \\\ your code goes here \\\ 8 i
Step1: Access dict value via key
<Expression>quantity = food_quantity_pairs[key_name]</Expression>
Step2: Print the required output
<Expression>print(key_name, "is:", quantity)</Expression>
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
food_quantity_pairs = {"peaches": 52, "milkshakes": 29}
key_name = input()
print(key_name, "is:")
quantity = food_quantity_pairs[key_name]
print(quantity)
Or combined in one print statement for the final line:
food_quantity_pairs = {"peaches": 52, "milkshakes": 29}
key_name = input()
print(key_name, "is:", food_quantity_pairs[key_name])