Python
x
11
1
def ex1():2
print("ex1")3
4
def ex2():5
print("ex2")6
7
functions = {1: ex1, 2: ex2}8
9
functions[1]()10
functions[2]()11
$ python3 prog.py
Start
ex1 ex2
0
Finish
Python
def ex1(): print("ex1")def ex2(): print("ex2")functions = {1: ex1, 2: ex2}functions[1]()functions[2]()$ python3 prog.py
Start
ex1 ex2
0
Finish