I am trying to get my code to allow one of 2 valid entries from the user. It will allow the exit input, but will not allow the direction input. Instead it continues to prompt and print out Invalid entry when user enters south. I have set it as an input option, so why can I only get the code to recognize exit or to recognize south (when code is edited), but never both arguments. What am I doing wrong here?
#A dictionary for the simplified dragon text game
#The dictionary links a room to other rooms.
rooms = {
'Great Hall': {'South': 'Bedroom'},
'Bedroom': {'North': 'Great Hall', 'East': 'Cellar'},
'Cellar': {'West': 'Bedroom'}
}
global current_room, validate, next_room
#next statement allows top line in python to be hidden for a cleaner look while testing
print('\n' * 10)
#gives user their starting location
print('Your starting and current location is the Great Hall.\n')
#sets current location for easier room transition when user moves
current_room = 'Great Hall'
#should validate the user inputs the correct direction with set parameters
validate = {'up': 'north', 'down': 'south', 'right': 'east', 'left': 'west', 'exits': 'exit'}
#if statement prompts user for input anytime the location is great hall
if current_room == 'Great Hall':
next_move = str(input('You can only travel south from the Great Hall. \nEnter south to
continue or exit:'))
#should prompt user until validated entry is entered
#FIXME
while next_move not in validate['down' and 'exits']:
print('\nInvalid entry.\n')
next_move = str(input('\nEnter south or exit:'))
continue
#FIXME
#Does not recognize south as valid entry...WHY??
if next_move in validate['down']:
print('\nYou are now in the Bedroom.')
current_room = 'Bedroom'
else:
next_move in validate['exits']
exit('\nThanks for playing. Goodbye.')