Skip to content

Scripts made with python. It allows you to interpret RPN operations and find the result.

Notifications You must be signed in to change notification settings

zakt67/RPN-model-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Python reverse polish notation (RPN) operations interpreter

Scripts made with python. It allows you to interpret RPN operations and find the result.

Authors

Usage

Clone the project :

  git clone https://github.com/zakt67/ReversePolishNotation.git

Go to the project directory :

  cd ./RPN-model-calculator

Create a new python file and import rpn.py file :

  from rpn import *

Call the funcitons as needed :

  # Digits only usage
  digits_calculation("your operation goes here")

  # Basic numbers usage
  numbers_calculation("your operation goes here")

  # Floats support usage
  float_calculation("your operation goes here")

Format exemple :

  numbers_calculation("1245-*+") # It calculate : 1 + 2 * (4 - 5)

Add assertion tests (Optionnal) :

  # Digits
  assert digits_calculation("132-+") == 2

  # Numbers
  assert numbers_calculation("(120)(10)*") == 1200

  # Floats
  assert float_calculation("(2.4)8/") == 0.3

About

Scripts made with python. It allows you to interpret RPN operations and find the result.

Topics

Resources

Stars

Watchers

Forks

Languages