python lambda: function

Import the reduce functools from 
List1 = List2 = list3 = [ "A", "B", "C", "D"] 
permutations a, b, cd 3 composition results into a string of letters will not be repeated a total of how many?
Method a: DEF the Add (X, Y): return [STR (I) + STR (J) for I in X for J in Y] Result = the reduce (the Add, [List1, List2, list3]) Method Two: foo = the lambda NP: the reduce (the lambda X, Y: [STR (I) + STR (J) for I in X for J in Y], NP) RES = foo (NP = [List1, List2, list3]) Print (len ( res), len (list (set (res))))
answer: 64 kinds of
toys. 1: OO = (the lambda X, Y, Z: X * Y * Z) (3,4,6) Print (OO)
toys 2 : Lower the lambda = X, Y: X IF X <Y Y the else PP = Lower (1,2) Print (PP)
Toys three: Import SYS showAll the lambda = X: List (Map (sys.stdout.write, X)) showAll ([ 'Jerry \ n-', 'Sherry \ n-', 'Alice \ n ']) showall = lambda x: [sys.stdout.write(line) for line in x] showall(('I\t','Love\t','You!'))

  

Guess you like

Origin www.cnblogs.com/SunshineKimi/p/11105409.html