You can use the combinations()
function from the itertools
module to generate all possible combinations of three elements from a given list. Here's an example:
main.py137 chars8 lines
This will output all possible combinations of three elements from the list ['a', 'b', 'c', 'd', 'e']
.
main.py160 chars11 lines
gistlibby LogSnag