Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

undefined 1. Filename: assign1-9.py Player's Inventory Program: The Player's Inventory Program maintains an inventory of a player from a typical role-playing game. Like most role-playing

image text in transcribedundefined

1. Filename: assign1-9.py Player's Inventory Program: The Player's Inventory Program maintains an inventory of a player from a typical role-playing game. Like most role-playing games ever created, the player is from a small, insignificant village. The player has been roaming around, gathering & using items, and would like to create an inventory list of their possessions. 1. Create a list that stores the following items: clothing (armor), clothing (formal), healing potion, shield, & sword. Use a for loop to print out each item in the list. Use a function to determine how many items are in the list and inform the player of the number of items in their inventory. 2. During the game, the player took a wrong turn and fell into a viper pit (the player has lost a lot of health and is about to be attacked). Alter the program to determine if the player has a healing potion in their inventory. If they have a healing potion, inform the player that they survive the fall and remove the healing potion from their inventory. Inform the player of how many items they now have in their inventory. 3. After (hopefully) surviving the viper pit, the player has found a chest and wants to add the items to their inventory. Create a new list that holds the contents of the chest: 5 gold pieces, 3 gems, & mana potion. Concatenate the chest list to the inventory list. Inform the player of how many items they now have in their inventory. 4. The player decides to return to town, but is robbed of all of the items in their inventory along the way. Alter the program to delete all of the items in the inventory list. Inform the player of how many items they now have in their inventory. H:\>python C:\Users aslsabbaghpourhokma\Documents\IT2431\Modulel\assign1-9.py Your items: clothing (armor) clothing (formal) healing potion shield sword You have 5 items in your inventory. You have fallen into a viper pit. You use a healing potion and survived the fall. You have 4 items in your inventory. You have found a chest which contains: ['5 gold pieces', '3 gems', 'mana potion'] The contents of the chest has been added to your inventory. You have 7 items in your inventory. You have been robbed. You have @ items in your inventory

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

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions

Question

=+1 What would you do if you were the IHR manager?

Answered: 1 week ago