Git Product home page Git Product logo

smart_calculator's Introduction

Smart Calculator

Demo

A basic python REPL application to calculate simple mathematical equation

Architecture

The App is divided into:

  1. The main interface
  2. The Validator, to validate the inputs
  3. The Tokenizer, to transform validated inputs into list of tokens
  4. The Calculator, to calculate tokenize equation into digit
  5. The Command, to call the built in commands from inputs
  6. The Exception, to represent custom errors
  7. The Variable to represent a variable
  8. The Digit to represent the numeric operands
  9. The Operator to represent the Operator
  10. The Memory to represent as a store for numeric value of Variable

Feature

  1. Store and use variables in your equation!
  2. Parenthesis, Multiplication, Division, Exponentiation, Addition, Subtraction and Assignment!
  3. Stuck? use help! (/help)

How it works

python calculator/calculator.py
> 8 * 3 + 12 * (4 - 2)
48
> 2 - 2 + 3
3
> 4 * (2 + 3
Invalid expression
> -10
-10
> a=4
> b=5
> c=6
> a*2+b*3+c*(2+3)
53
> 1 +++ 2 * 3 -- 4
11
> 3 *** 5
Invalid expression
> 4+3)
Invalid expression
> /command
Unknown command
> /exit
Bye!

Requirements

Tested to work and run properly on python 3.8.5

smart_calculator's People

Contributors

nold2 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.