daily pastebin goal
7%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. list1 = ["a", "b", "c", "d"]
  2.    list2 = [1, 2, 3]
  3.      
  4. [a b c 1 2]
  5.         [a b c 1 3]
  6.         [a b c 2 3]
  7.         [a b d 1 2]
  8.         [a b d 1 3]
  9.         [a b d 2 3]
  10.         [a c d 1 2]
  11.         [a c d 1 3]
  12.         [a c d 2 3]
  13.         [b c d 1 2]
  14.         [b c d 1 3]
  15.         [b c d 2 3]
  16.      
  17. import itertools
  18. from itertools import combinations
  19.  
  20. def combi(arr, r):
  21.     return list(combinations(arr, r))
  22.  
  23. # Driver Function
  24. if __name__ == "__main__":
  25.     a = ["a", "b", "c", "d"]
  26.     r = 3
  27.     a= combi(arr, r)
  28.     print (a)
  29.     b = [1, 2, 3]
  30.     s =2
  31.     b = combi(brr, s)
  32.     print (b)
  33.     crr = a + b
  34.     print (crr)
  35.     c = combi(crr, 2)
  36.     print (c)
  37.     for i in range(len(c)):
  38.         for j in range(len(c)):
  39.             print c[i][j]
  40.             print 'n'
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top