Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

challenge activity 3.5.1: dictionary basics. jump to level 1 696352.578…

Question

challenge activity 3.5.1: dictionary basics. jump to level 1 696352.5789449.93597 dictionary food_quantities contains three key - value pairs, each representing a food name and the quantity needed. delete the pair associated with key_name from food_quantities. click here for example 1 food_quantities = {\strawberries\: 31, \waffles\: 26, \pizzas\: 78} 2 3 key_name = input() 4 5 \\\ your code goes here \\\ 6 7 print(
emaining pairs:\) 8 print(food_quantities)

Explanation:

Step1: Remove key-value pair

if key_name in food_quantities:
    del food_quantities[key_name]

Step2: No extra steps needed

(The input, initial dict, and print steps are already provided)

Answer:

food_quantities = {"strawberries": 31, "waffles": 26, "pizzas": 78}
key_name = input()
# Your code goes here
if key_name in food_quantities:
    del food_quantities[key_name]
print("Remaining pairs:")
print(food_quantities)