1. Create a list called item bag, and have it contain one element called “healthpotion”, and add three other items of your choosing using the append function. Do this so that you have at least 4 elements in that list.
2. Display all items/elements in the itembag

Respuesta :

DALAU

Answer:

=============================

copyable code

=============================

#text adventure game

#define a list itembag with 1 item

itembag = ["healthpotion"]

#add 3 more items to bag

itembag.append("foods")

itembag.append("water")

itembag.append("rope")

typedWord = input("Type a word here: ") #prompt user to type a word

if typedWord == "item": #if typed word is item

print("Items in bag are: ",itembag) #display itembag

weapons = ["sword","leather armor"] #define weapons list with 2 default weapons

moveToARoom = input("Move to a room? Y/N:") #ask user move to room question

if moveToARoom == "Y":#based on the answer Y

print("Found a new sword - The 'SteelSword'!")

 

#replace sword with steelsword in weapons

for index,weapon in enumerate(weapons):

  if weapon == "sword":

  weapons[index] = "steelsword"

  #end if

  #end for loop

print("Weapons are:",weapons)#print weapons

==========================

code screenshot

==========================

Ver imagen DALAU
Ver imagen DALAU
ACCESS MORE