Skip to main content

Possible permutations with repetition - Python Library

Project description

pcomp-1.3.2:

A simple library that calculates all possible permutations (with repetition) from an iterator and a length.

Functions:

area:

Calculate the area for permutation computation.

Parameters:

iterable (Iterable): The iterable object.

length (int): The length for permutation computation.

Returns:

int: The area for permutation computation.

pc:

Generate permutations of given iterable with specified length.

Parameters:

iterable (Iterable): The iterable object.

length (int): The length for permutation computation.

Returns:

list: List of permutations of the given iterable with the specified length.

Example(hex to binnary):

Code:

import pcomp

print("Area:", pcomp.area(range(2), 4)) # it returns: 16

print("Permutations with repetition:", pcomp.pc(range(2), 4)) # it returns: [[0, 0, 0, 0], [0, 0, 0, 1], ..., [1, 1, 1, 1]]

The area function returns the total number of possible permutations with repetition.

And the pcomp function returns a list where each sublist represents one permutation.

Change Log

1.3.2 (18/3/2024)

  • typo

1.3.1 (18/3/2024)

  • typo

1.3 (18/3/2024)

  • Improved code readability and readme

1.2.1 (28/11/2022)

  • typo

1.2 (28/11/2022)

  • Added error exception for invaide arguments

1.1.1 (22/8/2022)

  • combinations --> permutations with repetition (word replacement due to typo) (I might add combinations in the future + repetition True-False) (The package name will remain the same)

  • Version 1.0.2 in the changelog was 2 times (typo)

1.1.0 (19/8/2022)

  • New return form
  • The all function has been renamed to pc
  • Better file organization and function syntax

1.0.2 (10/7/2022)

  • Added github

1.0.1 (10/7/2022)

  • Fixed a problem

1.0.0 (10/7/2022)

  • First Release

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

pcomp-1.3.2.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

pcomp-1.3.2-py3-none-any.whl (3.8 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