u=4 print eval('u*u+7') # 23 def f (x): return x+5 print eval('f(2)+17') # 24 print eval('f(u+1)') # 10 def sommaf (F,x,y): f=eval(F); return f(x)+f(y) def cubo (x): return x*x*x print sommaf('cubo',2,5) # 133 --------------------------------------- def sommaf (F,x,y): f=globals()[F]; return f(x)+f(y) --------------------------------------- a='x=8; y=6; print x+y' exec(a) # 14 --------------------------------------- x=0; comando='x=17' def f (): global x exec comando f(); print x # 0 --------------------------------------- x=0; comando='global x; x=17' def f (): exec comando f(); print x # 17 --------------------------------------- a=[1,3,-5,0,-3,7,-10,3] a.sort(key=abs) print a # [0, 1, 3, -3, 3, -5, 7, -10] --------------------------------------- a=[3454,819,99,4545,716,310] a.sort(key=lambda x: x%100) print a # [310, 716, 819, 4545, 3454, 99] --------------------------------------- def conflun (a,b): if len(a)