Python 3.2.3 (default, Apr 11 2012, 07:15:24) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> print(2**10) 1024 >>> x = 2**10 >>> print(x) 1024 >>> (lambda x:x+2) at 0x00B59150> >>> (lambda x:x+2)(6) 8 >>> plus2 = lambda x:x+2 >>> plus2(6) 8 >>> def make_pow(n): return lambda x:pow(x,n) >>> sqr = make_pow(2) >>> type(sqr) >>> sqr(3) 9 >>> cub = make_pow(3) >>> cub(2) 8 >>> def make_pow(n): def fixed_exponential_pow(x): return pow(x,n) return fixed_exponential_pow >>> sqr = make_pow(2) >>> sqr(4) 16 >>> l = ["michal","amir","daniel","amiram"] >>> l ['michal', 'amir', 'daniel', 'amiram'] >>> sorted(l) ['amir', 'amiram', 'daniel', 'michal'] >>> sorted (l, key=lambda s:len(s)) ['amir', 'michal', 'daniel', 'amiram'] >>> sorted(l, key=lambda s:s[::-1]) ['michal', 'daniel', 'amiram', 'amir'] >>> l1 = ["1111","2","33"] >>> sorted(l1,key=int) ['2', '33', '1111'] >>> def compose(f1,f2): def com(x): return f1(f2(x)) return com >>> h1 = compose(lambda x:x+1, lambda x:2*x) >>> h1(5) 11 >>> h1 = compose(lambda x:2*x,lambda x:x+1) >>> h1(5) 12 >>> def compose(f1,f2): return lambda x:f1(f2(x)) >>> h1 = compose(lambda x:x+1, lambda x:2*x) >>> h1(5) 11 >>> def plus1(x): return x+1 >>> h1 = compose(plus1, lambda x:2*x) >>>