Closed codyswanner closed 1 year ago
The problem is that if the user enters anything other than 'exit' it will still go through the below set of code
if selection < len(games):
cont = True
while cont:
games[selection].terminalGame()
cont = input('Would you like to play this game again? (y/n): ')
cont = True if cont.lower() == 'y' else False
else:
print('There are not that many games!')
continue
If that gets moved into the if statement where it checks if it is numeric then that should fix it.
if selection.isnumeric():
selection = int(selection) - 1
elif selection == 'exit':
exit(0)
else:
print('Invalid input')
continue
Didn't notice this at first, the while loop check also breaks it.
On the prompt for "To select a game enter it's number" (currently line 14), main.py is expecting an input type of int and crashes on user input of a string. Add a check for strings and handle them appropriately before going to the top of the loop where there is a check that can only be passed by numeric types.