def run_other_function(other_function): print other_function(16) def cube(x): return x*x*x def square(x): return x*x run_other_function(cube) run_other_function(square) def give_function(choice): if choice == 1: return cube if choice == 2: return square else: return lambda (x): x*x*x*x rv = give_function(1) print rv(3) print give_function(2)(5) print give_function(3)(5) print (lambda (x): x*2)(4)