def Func1():
print ('Hello from Func1')
def Func2():
print ('Hello from Func2')
call = { 1: Func1, 2: Func2 }
import os, time
def Menu():
width = os.get_terminal_size().columns
print("Schiffssysteme".center(width, '='))
print("[1] Energiesystem")
print("[2] Sonstige Systeme")
print("=".center(width, '='))
Eingabe = input("Auswahl: ")
try: #to test if input is a number
Eingabe = int(Eingabe)
if Eingabe in call:
return Eingabe
except ValueError:
pass
print("Bitte Zahl eingeben!")
time.sleep(1)
Menu()
choice = Menu()
call[choice]()
#M# function variable name call, call function with variable name, input choice, integer validation, error prevention