Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Collections (2016, retired 2019) Dungeon Game Movement

Kate Bishop
Kate Bishop
1,410 Points

for this part in the dungeon game im getting an error to do with the input function?

monster, door, player = get_locations()
while True: valid_moves = get_moves(player) clear_screen() print("Welcome to the dungeon!") print("You're currently in room {}".format(player)) #fill with player position print("You can move {}".format(", ".join(valid_moves))) #fill with avalible moves print("Enter QUIT to quit")

move = input("> ")
move = move.upper()

if move == "QUIT":
    break
if move in valid_moves:
    player = move_player(player, move)
else:
    print("\n ** Walls are hard! Dont run into them! **\n")
    continue

Heres what in prints out:

Welcome to the dungeon! You're currently in room (3, 3) You can move LEFT, RIGHT, UP, DOWN Enter QUIT to quit

QUIT Traceback (most recent call last): File "Untitled.py", line 60, in <module> move = input("> ") File "<string>", line 1, in <module> NameError: name 'QUIT' is not defined

1 Answer

Andrey Misikhin
Andrey Misikhin
16,529 Points

I don't see mistakes, but it will be better if you show all your listing with formating.