pascal-triangle
Module for generating and printing Pascal's Triangle
Requires Python 3.9 (type hints)
Explicit implementation of Pascal's Triangle algorithm. Each row can be generated separately from all others. This vastly speeds up time if all you need is row 100 for example. This module is intended to be useful for mathematics or anytime a row(s) of Pascal's triangle might be useful.
Installation
Pascal-triangle can be installed directly with pip to use as a library and shell command by running pip install pascal-tri
OR clone the repo and run python -m pascal
Includes methods for
- generating a list of triangle rows
- pretty printing a triangle with correct spacing and alignment
The pascal module defines the following methods, access with
from pascal import *
# To generate a explicit row 'n' of Pascal's triangle:
calculate_row(n: int) -> PascalRow
# To generate a list of 'n' rows:
pascal(n: int) -> PascalTriangle
# Pretty print to stdout a triangle with 'n' rows or (optionally) a supplied triangle:
print_pascal(n: int, triangle: PascalTriangle = None) -> None
Can be run as a script as well.
python -m pascal [-h] [-l LINES]
If LINES not specified, runs in interactive loop
Learning objectives
This project exists as an exercise in learning these techonlogies/concepts
- Python type hinting (VS code intellisense integration)
- Making distributable Python packages (PyPi)
Metadata
Release files for pascal-tri 1.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pascal-tri-1.2.6.tar.gz | 4.3 kB | Without provenance | Details for pascal-tri-1.2.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pascal_tri-1.2.6-py3-none-any.whl | Python 3 | none | any | Details for pascal_tri-1.2.6-py3-none-any.whl |
Total release size: 10.9 kB
Release files / pascal-tri-1.2.6.tar.gz
| Download URL | pascal-tri-1.2.6.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1a40f5b95b90f5bc4fe5ec8dff4e26b07b752eadeefbdb7d2bbfb1aba02379f6
|
|
BLAKE2b-256 checksum How to use checksums |
a0164f6d37cfdd51e8093c2dfa50a0810b827edbbabec11116d4a4e6c47f1171
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5
|
Release files / pascal_tri-1.2.6-py3-none-any.whl
| Download URL | pascal_tri-1.2.6-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c36b55faf1f55030a510ffbc2002e0015b0964ba466db5ed1cbd80b2b8b515f3
|
|
BLAKE2b-256 checksum How to use checksums |
992d5e34ffa576b577a759d1bac9741fe01c4a057a3f0136f16131cdba6bb45f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5
|
Security for pascal-tri 1.2.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.