RPN Calculator by Akbar BadShah
It's a full-fledged rpn calculator I made to practice my pythonic skills. Works fine to the best of my knowledge, but you're still welcome to share your thoughts, add features, report and correct bugs.
New Features!
+: Take 2 numbers from the stack, add them and put the result in the stack-: Take 2 numbers from the stack, substracte them and put the result in the stack*: Take 2 numbers from the stack, mul them and put the result in the stack/: Take 2 numbers from the stack, divise them and put the result in the stackcla: Clear both stack and variableclr: Empty the stackclv: Clear both stack and variable!: None!=: Return True if last two numbers in stack are equal, False otherwise%: Take 2 integers from the stack, divide them and put the remainder in the stack++: Increment an integer--: Decrement an integer&: Take 2 numbers from the stack, apply a bitwise "and" and put the result in the stack|: Take 2 numbers from the stack, apply a bitwise "or" and put the result in the stack^: Take 2 numbers from the stack, apply a bitwise "xor" and put the result in the stack~: Take 2 numbers from the stack, apply a bitwise "xor" and put the result in the stack<<: Take 2 numbers from the stack, apply a left shift and put the result in the stack>>: Take 2 numbers from the stack, apply a right shift and put the result in the stack&&: Perform boollean AND operation on two values and output the result (not added to the stack)||: Perform boollean OR operation on two values and output the result (not added to the stack)^^: Perform boolean XOR operation on two values and output the result (not added to the stack)<: Smaller than operation on two values and output the result (not added to the stack)<=: Smaller than or equal to operation on two values and output the result (not added to the stack)==: Equal to operation on two values and output the result (not added to the stack)>: Greater than operation on two values and output the result (not added to the stack)>=: Greater than operation on two values and output the result (not added to the stack)acos: Take arc cosine on a value and output the result (also added to the stack)asin: Take arc sine on a value and output the result (also added to the stack)atan: Take arc tangent on a value and output the result (also added to the stack)cos: Take cosine on a value and output the result (also added to the stack)cosh: Take arc hyperbolic cosine on a value and output the result (also added to the stack)sin: Take sine on a value and output the result (also added to the stack)sinh: Take hyperbolic sine on a value and output the result (also added to the stack)tanh: Take hyperbolic tangent on a value and output the result (also added to the stack)ceil: Take ceil of an integer and output the result (also added to the stack)floor: Take floor of an integer and output the result (also added to the stack)round: Take round of an integer and output the result (also added to the stack)ip: Separates int from floating part of a decimal number and output the result (also added to the stack)fp: separates floating part of a decimal number and output the result (also added to the stack)abs: Take ceil of an integer and output the result (also added to the stack)max: Take maximum value of the stack and output the result (also removed from the stack)min: Take minimum value of the stack and output the result (also removed from the stack)hex: Change display mode to hexbin: Change display mode to binarydec: Change display mode to decimale: Nonepi: Nonerand: Noneexp: Apply e**x to the last number of the stackfact: Push factorial of the last number to the stacksqrt: Push factorial of the last number to the stackln: Apply log10 to the last number of the stacklog: Apply log10 to the last number of the stackpow: Take 2 numbers from the stack, apply power and put the result in the stackpick: Pick the nth item form stackrepeat: Repeat an operation n timesdrop: Drop the top most item from the stackdropn: Drop the n top most items from the stackdup: Duplicates the top item from the stackdupn: Duplicates n top items of thew stackroll: Roll the stack upwards by nrolld: Roll the stack downwards by nstack: Toggles stack display from horizontal to verticalswap: Swap the top 2 stack itemsx=: Assigns a variable, e.g. '1024 x='help: Print help; Same as pol --listexit: Quit the program
Available Modes
- For one time result of a single line statement, do:
rpn 3 2 + #(should exit outputting 5)
- To solve statements from a file before entering shell, do:
rpn --file #path
- To simply enter the shell, do:
rpn
Installation
pip install advanced_rpn_calculator
Todos
- Write MORE Tests or just test if everything works fine.
License
MIT
Free Software, Hell Yeah!
Metadata
Release files for advanced-rpn-calculator 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| advanced_rpn_calculator-0.1-py3-none-any.whl | Python 3 | none | any | Details for advanced_rpn_calculator-0.1-py3-none-any.whl |
Release files / advanced_rpn_calculator-0.1-py3-none-any.whl
| Download URL | advanced_rpn_calculator-0.1-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d7424f702c301d5dacad461511bbdc0c4da196d665f2ee0c4909cd6e67aebd7
|
|
BLAKE2b-256 checksum How to use checksums |
2a6eead1a8332352c5ab63a2162733c023d6100f0099712d46c23b9f257dd75b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.4.2 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.2
|
Security for advanced-rpn-calculator 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.