0

python function return

is there any way to use the return to transfer control to any other function other then the main function

11th Aug 2018, 12:45 AM
Arun Sharma
Arun Sharma - avatar
3 Answers
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)
11th Aug 2018, 5:30 AM
Louis
Louis - avatar