Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Ai And The Lottery Defying Odds With Intelligent Prediction

Authors: Gary Covella Ph D

1st Edition

B0CND1ZB98, 979-8223302568

More Books

Students also viewed these Databases questions