new Quit and Restart functionality

This commit is contained in:
adamercat 2020-12-10 10:13:16 +01:00
parent dbba059482
commit 4ae599735f
1 changed files with 15 additions and 1 deletions

View File

@ -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()