Answers for "conmbination in python"

0

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)
Posted by: Guest on April-22-2022
0

conmbination in python

# A Python program to print all
# permutations using library function
from itertools import permutations
 
# Get all permutations of [1, 2, 3]
perm = permutations([1, 2, 3])
 
# Print the obtained permutations
for i in list(perm):
    print (i)
Posted by: Guest on April-22-2022

Python Answers by Framework

Browse Popular Code Answers by Language