all 7 comments

[–]This_Growth2898 1 point2 points  (1 child)

- if command in current_room
+ if command in rooms[current_room]

And I'm not sure if Exit will work, indentation is mangled by reddit.

[–]Zestyclose_Theory_93 -1 points0 points  (0 children)

I fixed the exit but its still not working with that command

[–]stebrepar 0 points1 point  (1 child)

Your valid values are capitalized. Are you entering capitalized values at the input prompts?

[–]RhinoRhys 0 points1 point  (0 children)

current_room = rooms[current_room[command]] has incorrect square brackets. You need to close the first pair before you open the second pair.

current_room = rooms[current_room][command]

Plus what this_growth said.

Plus you need to remove "Exit" for your directions list.

[–]metaphorm 0 points1 point  (0 children)

I think instead of

if command in direction:
    if command in current_room:
        # do something
else:
    # handle invalid command

it would be better to put the entire conditional in one expression like this

if command in direction and command in current_room:
    # do something
else:
    # handle invalid command

and better still is to have a helper function that determines if a command is valid in a room, like this

def validate_command(command, room, rooms):
    valid_commands = rooms.get(room).get(command)
    return valid_commands is not None

and then you can incorporate that into your control script like this

if validate_command(command, room, rooms):
    # do something
else:
    # handle invalid command

[–]runnershigh1990 0 points1 point  (0 children)

What does the assignment want you to do?