Skip to main content

A package that generates all possible combinations in a given set as a list

Project description

The package

combs is a package used to generate all possible combinations of a given length k on a given set. The set is given as a list, and k must be equal to 0 or positive.

Usage examples

With integers

from combs import combinations

l = [89,32,6,7]
k = 2
combs = combinations.find_combinations(l, k)
print(combs)

Output :

[[89, 32], [89, 6], [89, 7], [32, 6], [32, 7], [6, 7]]

With strings

from combs import combinations

l = ["github", "gitlab", "azuredevops", "svn"]
k = 3
combs = combinations.find_combinations(l, k)
print(combs)

Output :

[['github', 'gitlab', 'azuredevops'], ['github', 'gitlab', 'svn'], ['github', 'azuredevops', 'svn'], ['gitlab', 'azuredevops', 'svn']]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyCombs-1.0.0.tar.gz (15.3 kB view hashes)

Uploaded Source

Built Distribution

PyCombs-1.0.0-py3-none-any.whl (15.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page