Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/crespo/reverse-polish-notation
Simple Reverse Polish Notation calculator. It works with integer numbers only and the basic operators (+, -, *, /). The division result is the integer part of it.
https://github.com/crespo/reverse-polish-notation
calculator reverse-polish reverse-polish-notation rpn rpn-calculator
Last synced: about 2 months ago
JSON representation
Simple Reverse Polish Notation calculator. It works with integer numbers only and the basic operators (+, -, *, /). The division result is the integer part of it.
- Host: GitHub
- URL: https://github.com/crespo/reverse-polish-notation
- Owner: crespo
- Created: 2024-04-24T18:52:54.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-04-24T19:20:16.000Z (9 months ago)
- Last Synced: 2024-04-25T20:21:50.781Z (9 months ago)
- Topics: calculator, reverse-polish, reverse-polish-notation, rpn, rpn-calculator
- Language: Python
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Reverse Polish Notation Calculator
Simple Reverse Polish Notation calculator. It works with integer numbers only and the basic operators (+, -, *, /). The division result is the integer part of it.## How it works:
1. Read a input.
2. If it is an integer (operand), push to the stack.
3. If it is an operator, pop the last and second-to-last operands off the stack, do the operation and then push it back to the stack.
4. If it is empty, close the program.## Usage:
1. ```git clone https://github.com/crespo/reverse-polish-notation.git```
2. ```cd ./reverse-polish-notation```
3. ```python main.py```
4. ```Type a integer number or a basic operator (+ = sum, - = subtraction, * = multiplication, / = division) and ↵ Enter.```
5. ```When you've finished, type ↵ Enter again and the program should stop.```## Example:
#### ![an example of the algorithm working. it contains a CLI with the following user inputs: 10, 15, 5, /, 4, *, -, 10, +. The final result is 8](example.png "Example")