0
python function return
is there any way to use the return to transfer control to any other function other then the main function
1 Odpowiedź
0
#like this?
def func1(x):
print('executing function 1: x =',x)
return x+1
def func2(x):
print('executing function 2: x =',x)
return x+3
def choose(x):
if x%2:
return func1(x)
else:
return func2(x)
x=0
while(x<20):
x=choose(x)