Answers for "pairwise function python"

0

pairwise function python

# itertools — Functions creating iterators for efficient looping
# See : https://docs.python.org/3/library/itertools.html
import itertools
x = [A,1,B,2]
l = list(itertools.combinations(x, 2))
print(l)
[(A, 1), (A, B), (A, 2), (1, B), (1, 2), (B, 2)]
Posted by: Guest on July-26-2021

Code answers related to "pairwise function python"

Python Answers by Framework

Browse Popular Code Answers by Language