Skip to content

zilchmonkey/python-ai-agent

Repository files navigation

Disclaimer: This README file was written by AI that is implemented in this project.

Calculator App

This app is a simple calculator that can evaluate infix expressions with basic arithmetic operators (+, -, *, /). It also renders the expression and result in a box.

Usage

  1. Make sure you have Python installed.
  2. Save the calculator.py and render.py files in the same directory.
  3. You will need to run the files from the command line.

Example

To run the calculator, create a python script that uses the calculator and render functions. For example:

from pkg.calculator import Calculator
from pkg.render import render

calculator = Calculator()
expression = "1 + 2 * 3"
result = calculator.evaluate(expression)

if result is not None:
    print(render(expression, result))
else:
    print("Invalid expression")

Save this file as main.py and run it from the command line using python main.py.

Files

  • calculator.py: Defines the Calculator class.
  • render.py: Defines the render function.
  • morelorem.txt: This file doesn't seem to be used by the application. It is just a text file.

Notes

The calculator evaluates expressions based on operator precedence (* and / have higher precedence than + and -).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages