Skip to main content
RPN
===

Reverse Polish Notation calculator for Python.

Binary Operators
----------------

* ``+``: addition
* ``-``: subtraction
* ``*``: multiplication
* ``/``: true division
* ``%``: modulo
* ``//``: floor division
* ``**``: exponentation

Unary Operators
---------------

* ``abs``: absolute value
* ``sqrt``: square root
* ``ceil``: rounding up
* ``floor``: rounding down

Examples
--------

::
import decimal

import rpn
result = rpn.solve_rpn('3.4 -3 abs + 100 sqrt -')
print(result) # 3.6

try:
rpn.solve_rpn('3 3 3 +')
rpn.solve_rpn('3 +')
rpn.solve_rpn('abs')
rpn.solve_rpn('3 a +')
except RPNError:
...

try:
rpn.solve_rpn('0 5 /')
except decimal.DivisionByZero:
...

try:
rpn.solve_rpn('-5 sqrt')
except decimal.InvalidOperation:
...

try:
rpn.solve_rpn('9999999999999 9999999999999 **')
except decimal.Overflow:
...

CLI Usage
---------

::
$ rpn "1 2 + 8 -"
$ 5

Metadata

Release files for rpn 1.0

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

Source distribution (sdist)

Source distribution for rpn 1.0
File Size Uploaded Provenance
rpn-1.0.tar.gz 2.6 kB Without provenance Details

Release files / rpn-1.0.tar.gz

Download URL rpn-1.0.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c1923b2c401cfe6b77237d7993f21c2f7936eb898594be0d1a7e569ab74c0d98
BLAKE2b-256 checksum
How to use checksums
36ebd28fa89939368eab8de08474f7cd96a14febd6f29ad8cac7cd21c05cb04e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for rpn 1.0

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

1.0 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