Skip to main content

This script can be used as library to split division it to simple steps or as console script to visualise division.

Example usage as command line script:

$ python3 -m longdivision 1/3
_1 / 3 = 0.3333
 0  <- 0 * 3
 -
_10
  9  <- 3 * 3
 --
 _10
   9  <- 3 * 3
  --
  _10
    9  <- 3 * 3
   --
   _10
     9  <- 3 * 3
    --
     1

$ python3 -m longdivision 6359/17
_6359 / 17 = 374.0588
 51  <- 3 * 17
 --
_125
 119  <- 7 * 17
 ---
  _69
   68  <- 4 * 17
   --
   _10
     0  <- 0 * 17
    --
   _100
     85  <- 5 * 17
    ---
    _150
     136  <- 8 * 17
     ---
     _140
      136  <- 8 * 17
      ---
        4

Example usage as library:

>>> import longdivision
>>> list(longdivision.divide_integer_part(5, 2))
[(5, 4, 2, 1)]
>>> list(longdivision.divide_integer_part(1, 3))
[(1, 0, None, 1)]
>>> list(longdivision.divide_fractional_part(1, 3))
[(10, 9, 3), (10, 9, 3), (10, 9, 3), (10, 9, 3)]
divide_integer_part

Iterates over all division steps providing reminder, quotient, result_digit, numerator_position.

divide_fractional_part

iterates over fractional part. Each iteration returns same results as divide_integer_part escape last numerator_position. Reminder argument for this function must be taken from last divide_integer_part iteration.

Metadata

Release files for longdivision 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for longdivision 0.1
File Size Uploaded Provenance
longdivision-0.1.tar.gz 15.5 kB Without provenance Details

Release files / longdivision-0.1.tar.gz

Download URL longdivision-0.1.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
04dbd0f5fc11d593bbb58560776891ac16cc3f8693f8f1cfbc60c9a1fa04eb47
BLAKE2b-256 checksum
How to use checksums
f1b71141c028e56e1d343a14d6347fb748cac638a3d42b001fec945333a64fec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for longdivision 0.1

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.

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page