Question

Fruit Dictionary (1) Create a Python Dictionary named fruit_color with three keys: "watermelon", "mango", and "strawberry"....

Fruit Dictionary

(1) Create a Python Dictionary named fruit_color with three keys: "watermelon", "mango", and "strawberry". Their values are "green", "yellow", and "red", respectively.

(2) Add a new key "mandarin" with its value "orange" to the dictionary.

(3) Remove the key "mango" from the dictionary.

(4) Use a for loop to iterate over all the key-value pairs in the dictionary, and print out all the key-value pairs, each key-value pair in one line. Format: key : value. Example (order may be different):

watermelon : green
mandarin : orange
strawberry : red

0 0
Add a comment Improve this question Transcribed image text
Answer #1
fruit_color = {"watermelon":"green","mango":"yellow","strawberry":"red"}
fruit_color["mandarin"] = "orange"
del fruit_color["mango"]
for x in fruit_color.keys():
    print(x,":",fruit_color[x])
Add a comment
Know the answer?
Add Answer to:
Fruit Dictionary (1) Create a Python Dictionary named fruit_color with three keys: "watermelon", "mango", and "strawberry"....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT