How to execute multiple value in python dictionary?
def func1():
pass
def func2():
pass
def func3():
pass
def func4():
def main_menu():
os.system('clear')
print("\nWelcome, \n\n")
print("1. First Question")
print("2. Second Question")
print("\n\n Type 'q' for Quit\n")
choice = input(" >> ").lower()
if choice == '':
main_menu()
else:
try:
main_menus[choice]()
except KeyError:
print("Invalid selection, Please try again.\n")
main_menu()
return
main_menus = {
'1' : func1,
'2' : func2,
}
i want main_menus
key have two value, like this for example
main_menus = {
'1' : func1, func4
'2' : func2, func3
}
so, if user input '1'
, it will execute func1
first, after finish, it will execute func4
..
i can't call func4
from func1
like this:
def func1():
return func4()
because func1
, maybe will be use by another main_menus
key, and will be pair with func3
..
anyone have solution for this, if can, better not use for loop.
Thank you