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'
startingroom 'Atrium'
currentroom startingroom
direction inputWhich way would you like to go
move North 'South', 'East', 'West'
def movingtodirection room'Atrium':
if direction 'South':
printroomsAtrium
while True:
printYou are in formatcurrentroom
if move 'South':
currentroom roomsAtrium
printYou are currently in formatcurrentroom
elif move 'South':
printSorry invalid selection please select again'
elif move 'quit':
printThank you for playing'
else:
printInvalid input'
break
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
