Question: My code isn't working. I have a couple issues, first being my rooms still don't connect, for example from the living room I can either

My code isn't working. I have a couple issues, first being my rooms still don't connect, for example from the living room I can either go north or south but it's not letting me go south into the hallway. Instead I have to east into the hallway so Im messing up somewhere there. It should work like this, you start in the living room and you can either go north or south. If you go south, you go the dining room the dining room is a dead end you can only go back up to the living room. Back to the living room this time you go north, you go into the hallway. From the hallway you have three options, east into the kitchen which is a dead end, west into the bedroom also a dead end and south back into the living room. Secondly, the start doesn't print the room desc and then after the first input, it prints it three times. Ive pasted the code below. Third, I need to create two new rooms and for some reason when I was trying to add them the code wasnt working so if anyway it would be possible for someone to add them. It would be a pantry only connected to the kitchen and a bathroom only connected to the bedroom, if not its fine I can figure it out the main problem is the rooms not connecting please try to explain and paste the new code so I can see it thanks. Ive pasted my code below.
# Creating the empty array room_list
room_list =[]
# Creating rooms
room =["You are in a major modern living room. You see a leather couch, barely used with tiny hairs all over it. You can go either north or south.", 1,2, None, None]
room_list.append(room)
room =["You are in a petite dining room. You can only go north.", None, None, 0, None]
room_list.append(room)
room =["You are in a modern hallway. There is a massive dog, that will eat you if you don't move fast. Quickly choose between the east or the west or the south.", None, 4,0,1]
room_list.append(room)
room =["You are in a brand new kitchen. You see a brand new 30-inch 6.2 cu. ft. Front Control Induction Range with Total Convection in Smudge - Proof Stainless. You can go to the hallway in the west.", None, 3,1, None]
room_list.append(room)
room =["You're in the biggest master bedroom in the world. It looks like the bed is ready to be slept on. There's a hallway to the east.", None, None, None, 2]
room_list.append(room)
# Creating a variable called current room to keep track of where they are
current_room =0
# Printing room list variable
print(room_list)
print(room_list[current_room][0])
done = False
# Started game loop
while not done:
print("") # Blank line
print(room_list[current_room][0]) # Room description printing
# Asking for input
direction = input("Where do you wanna go?").lower() # Asking for input side note # need's workss
if direction =='n' and room_list[current_room][1] is not None:
current_room = room_list[current_room][1]
elif direction =='e' and room_list[current_room][2] is not None:
current_room = room_list[current_room][2]
elif direction =='s' and room_list[current_room][3] is not None:
current_room = room_list[current_room][3]
elif direction =='w' and room_list[current_room][4] is not None:
current_room = room_list[current_room][4]
else:
print("You can't go that way!")

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!