Skip to the content.

3.8 Hw_ipynb_2_

# List of colors
colors = ['red', 'blue', 'green', 'yellow', 'purple']

# Iterate through the list of colors and print each one
for color in colors:
    print(color)
red
blue
green
yellow
purple
# Dictionary of fruits with their quantities
fruits = {
    'apple': 10,
    'banana': 5,
    'orange': 8,
    'grapes': 15,
    'mango': 3
}

# Iterate through the dictionary and print the fruit's name and quantity
for fruit, quantity in fruits.items():
    print(f"{fruit}: {quantity}")
apple: 10
banana: 5
orange: 8
grapes: 15
mango: 3