Question: I am unable to get my syntax to return the correct room from the dictionary when a valid direction is selected. rooms = { 'Atrium':

I am unable to get my syntax to return the correct room from the dictionary when a valid direction is selected.
rooms ={
'Atrium': {'South': 'Bedroom'},
'Bedroom': {'North': 'Atrium', 'East': 'Basement'},
'Basement': {'West': 'Bedroom'}
}
starting_room = 'Atrium'
current_room = starting_room
direction = input('Which way would you like to go?')
move =['North', 'South', 'East', 'West']
def moving_to(direction, room='Atrium'):
if direction == 'South':
print(rooms['Atrium'])
while True:
print('You are in {}'.format(current_room))
if move == 'South':
current_room = rooms['Atrium']
print('You are currently in {}'.format(current_room))
elif move != 'South':
print('Sorry, invalid selection please select again')
elif move == 'quit':
print('Thank you for playing')
else:
print('Invalid input')
break

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 Programming Questions!