Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For each comment, finish the Python command below it to perform the requested action. For each print statement, write out what the Python console would

For each comment, finish the Python command below it to perform the requested action. For each print statement, write out what the Python console would display when executing it. Assume all lines are executed as a single program.

wallets = {'Betty': {'currency': {'one': 3, 'five': 1, 'twenty': 2}}, # $48 'Bobby': {'photos': ['baby', 'lover'], 'ccards': 3, 'currency': {'hundred': 1, 'twenty': 6}}, # $220 'Sammy': {'bus': 'pass', 'currency': {'twenty': 3, 'one': 11}}} # $71

last_names = {'Betty': 'Smith', 'Sammy': 'Jones', 'Bobby': 'Orr', 'Sally': 'Saver'}

values = {'one': 1, 'five': 5, 'ten': 10, 'twenty': 20, 'fifty': 50, 'hundred': 100}

# 1. Get a list of wallet holders from the wallets dictionary in one line walleteers =

# 2. Then what is printed out by this line? print(walleteers)

# 3. Get the contents of Bobby's wallet without using a dot operator bobby_wallet =

# 4. Then what is printed out by this line? print(bobby_wallet)

# 5. Get the number of photos in Bobby's wallet using bobby_wallet (assigned above) bobby_photo_count =

# 6. Then what is printed out by this line? print(bobby_photo_count)

# After executing this line: wallets['Bobby']['currency']['hundred'] += 2

# 7. What is printed out by this line: print(bobby_wallet['currency'])

# 8. Does Betty have any hundred-dollar bills in her wallet # (use the in keyword and assign a boolean to betty_has_a_cnote) betty_has_a_cnote =

# 9. Then what is printed out by this line? print(betty_has_a_cnote)

# 10. invert the last_names dictionary first_names =

# 11. Then what is printed out by this line? print(first_names)

# 12. using the values dictionary sum up the value of all the currency in all the wallets money = 0 for name in wallets: currency = wallets[name]['currency'] for bill in currency: money +=

# 13. Then what is printed out by this line? print(money)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Restaurant Concepts, Management, And Operations

Authors: John R Walker

8th Edition

1119393582, 9781119393580

More Books

Students also viewed these General Management questions