Alright so i am total beginner here and I need help with what the code should look like to allow players to interact with other items in the room. I currently have a couple of items in each room and I would like for these items to help the player find the special item that they need in order to complete the game. I would love some suggestions as to what this should look like/where should I put this part of the code? I started to create a piece of this code at the bottom of my code, but it is not coming up when i run the code.
entry_way = ["Entry Way", ["car keys"], []] living_room = ["Living Room", ["paintings", "DVDs", "nice couches"], []] dining_room = ["Dining Room", ["chairs, table"], []] kitchen = ["Kitchen", ["a group of people talking"], []] bedroom = ["bedroom", ["tv, bed"],[]] patio = ["patio", [special_item], []] # Connect the rooms based on their relationship to # North, South, West, East entry_way[2] = [living_room, 0, 0, dining_room] dining_room[2] = [0, 0, entry_way, kitchen] living_room[2] = [0, entry_way, 0, bedroom] kitchen[2] = [0, patio, dining_room, 0] bedroom[2] = [0, dining_room, living_room, 0] patio[2] = [kitchen,0,0,0] # TODO #2 CREATE the body of print_message function # print_message takes in a room and based on what's # inside the room, will print out the appropriate # message to describe the room # For example, if room = ["Entry Way", ["car keys"], []] # This function should print the following message: # "You enter room Entry Way." # "You see in this room: keys." # You don't have to use those exact words, but make sure # you print out the name of the room and the items in the room def print_message(room): print("You are in room: " + room[0]) # Get the player's choice. # Validate the choice by making sure it's a room they can go to # Return a room based on the player's choice def get_player_choice(rooms): # get the players choice of what direction they want to go choice = input("Where do you want to go? (N, S, W, E) ") print(" ") # we're going to translate the string input to a # number that means a particular direction # -1 is an invalid direction # 0 is north # 1 is south # 2 is west # 3 is east direction = -1 while direction == -1: if choice == "N" or choice == "n": direction = 0 elif choice == "S" or choice == "s": direction = 1 elif choice == "W" or choice == "w": direction = 2 elif choice == "E" or choice == "e": direction = 3 if direction == -1: choice = input("Please enter N, S, W, E to move. ") elif rooms[direction] == 0: choice = input("You can't go in that direction. Try another direction (N, S, W, E): ") direction = -1 return rooms[direction] def main(): # start the adventure # and let the player know what they're looking for #New Extension print("You are in a mad dash to get to the airport!") print("You are just about to pull out of the driveway when you realize that your " + special_item + " is no where insight.") print("You need to find it so you can catch your flight!") print("You look around the house to find " + special_item) print("Remember that each of your rooms can help you find it!") # initialize the current_room to be the starting room # initialize the item_found boolean variable to False current_room = entry_way item_found = False # TODO #3 CREATE the body of this while loop (below) # While the special item is being searched for, # print a description of the current_room and # check if the special item is in the current_room. # Otherwise ask the player to make a choice. # hint: you'll need to use the functions print_msg() and get_player_choice() # and think about when you're in the room with the item or when you're not while not item_found: print_message(current_room) if special_item in current_room[1]: print("Congrats you found it!") print("Now go back to where you started.") item_found = True current_room = get_player_choice(current_room[2]) # TODO #4 After finding the special item, the player must go back # to the room where the player started. # hint: a while loop will be helpful to do this while item_found: #once item found print_message(current_room) if current_room == entry_way: #win print("Thank you for finding my phone!") break current_room = get_player_choice(current_room[2]) #display the room item if there is one def get_item(rooms): if "item" in rooms[current_room]: print("you see a " + rooms[current_room]["item"]) # call the main() function to start the program main()