Question: You are creating a fantasy video game. The data structure to model the players inventory will be a dictionary where the keys are string values

You are creating a fantasy video game. The data structure to model the players inventory will be a dictionary where the keys are string values describing the item in the inventory and the value is an integer value detailing how many of that item the player has.

the dictionary value {'rope': 1, 'torch': 6, 'gold coin': 42, 'dagger': 1, 'arrow': 12} means the player has 1 rope, 6 torches, 42 gold coins, and so on.

To complete the program (10 points):

* Create a module named h05_01.py from the directory hw

* Record your name, class number, and date of creation.

* Create an empty dictionary

* Add 1 rope, 6 torches, 42 gold coins, and so on until you have a dictionary like this:

{'rope': 1, 'torch': 6, 'gold coin': 42, 'dagger': 1, 'arrow': 12}

* Print the inventory in the following format:

Inventory:

12 arrow

42 gold coin

1 rope

6 torch

1 dagger

Total number of items: 62

Paste the captured screen here (5 points):

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!