Imagine that you spent a week eating only your favorite foods (from 1). Create a dictionary that contains the names of the food as keys & counts for each time you ate that food as values. For example, if you ate chocolate 9 times, the key would be "chocolate" and the value would be 9. Then, complete the following steps using python. Each step should be completed in a different cell and your results should be printed with print() . 1. Write code that counts how many times you ate. (In other words, add up all of the food counts.) Hint: use a for loop. 2. Add the food "ramen" to your dictionary and give it a count of 7. 3. Print out a list of the keys and a list of the values in your dictionary (i.e., the food names and the counts). Hint: use the functions .keys () and .values (). 4. Change the count for one of the foods in your dictionary (i.e., taco's count from 7 to 10). 5. Remove a key-value pair from your dictionary. Hint: Google "python delete dictionary entry" to find the answer.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Imagine that you spent a week eating only your favorite foods (from 1). Create a dictionary that contains the names of the food as keys & counts
for each time you ate that food as values. For example, if you ate chocolate 9 times, the key would be "chocolate" and the value would be 9. Then,
complete the following steps using python. Each step should be completed in a different cell and your results should be printed with print().
1. Write code that counts how many times you ate. (In other words, add up all of the food counts.) Hint: use a for loop.
2. Add the food "ramen" to your dictionary and give it a count of 7.
3. Print out a list of the keys and a list of the values in your dictionary (i.e., the food names and the counts). Hint: use the functions .keys () and
.values ().
4. Change the count for one of the foods in your dictionary (i.e., taco's count from 7 to 10).
5. Remove a key-value pair from your dictionary. Hint: Google "python delete dictionary entry" to find the answer.
Transcribed Image Text:Imagine that you spent a week eating only your favorite foods (from 1). Create a dictionary that contains the names of the food as keys & counts for each time you ate that food as values. For example, if you ate chocolate 9 times, the key would be "chocolate" and the value would be 9. Then, complete the following steps using python. Each step should be completed in a different cell and your results should be printed with print(). 1. Write code that counts how many times you ate. (In other words, add up all of the food counts.) Hint: use a for loop. 2. Add the food "ramen" to your dictionary and give it a count of 7. 3. Print out a list of the keys and a list of the values in your dictionary (i.e., the food names and the counts). Hint: use the functions .keys () and .values (). 4. Change the count for one of the foods in your dictionary (i.e., taco's count from 7 to 10). 5. Remove a key-value pair from your dictionary. Hint: Google "python delete dictionary entry" to find the answer.
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY