I'm completely new to coding and am working on a text based game as a school project using Python. The user must enter a room by typing 'North', 'East', 'South', or 'West'. If the direction is invalid, an error message should pop up, prompting the user to enter a new direction. If the user types 'Quit', the game should end.
There are a million issues I'm having with this project as I have found I am terrible at coding, but the one I am trying to figure out is how to get my program to quit the game if prompted. Here's my code (it isn't the full code, just what I have so far. I'm trying to figure things out just one step at a time and here's where I am stuck):
rooms = {
'Great Hall': {'South': 'Bedroom'},
'Bedroom': {'North': 'Great Hall', 'East': 'Cellar'},
'Cellar': {'West': 'Bedroom'}
}
def main():
current_room = 'Great Hall'
user_input = None
while user_input != "Quit":
print('You are in the', current_room + '.')
user_input = input('Where would you like to go?: ')
current_room = rooms[current_room][user_input]
else:
print('Thanks for playing!')
main()
When I run the program, I get this error message: Error Message
If anyone can point me in the right direction on what I need to fix, I would be very grateful!!