diff --git a/clean_input.py b/clean_input.py index 5fb84bf..1b2f4f2 100644 --- a/clean_input.py +++ b/clean_input.py @@ -1,5 +1,7 @@ """clean_input""" +import sys +import #main_gamemodule_plz_here #message needs to be a string that is printed for user instruction. options is a list of viable inputs def io(message: str, options: list) -> str: @@ -13,7 +15,19 @@ def io(message: str, options: list) -> str: if i in options: return i break + else: - print('Noch nicht ganz richtig. Hast du deine Auswahl auch richtig geschrieben?') + try: + print('Noch nicht ganz richtig. Hast du deine Auswahl auch richtig geschrieben?') + + except(i =='QUIT' or i == 'RESTART'): + + if i == 'QUIT': + print("Spiel wird beendet...") + sys.exit() + + if i == 'RESTART': + print("Spiel wird neu gestartet...") + #main_gamemodule_plz_here.game()