Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

conmbination in python

# A Python program to print all
# combinations of given length
from itertools import combinations
 
# Get all combinations of [1, 2, 3]
# and length 2
comb = combinations([1, 2, 3], 2)
 
# Print the obtained combinations
for i in list(comb):
    print (i)
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #conmbination #python
ADD COMMENT
Topic
Name
2+2 =