I have a program :
def mid(a, b):
if a == 0:
print(b)
r = b
r = r + 1
return r
while b != 0:
if a > b:
a = a - b
print(a)
r = a
return r
So I wanna use exec function to execute this program, like that :
exec('%s(*(tests[i]))' % funName)
with funName is "mid", tests[i] = (3,2) so when (a,b) = (3,2) the while loop become infinite loop and I can't get out of this loop at exec . Any suggest for me ?