Play Python
README.md

🧮 Python Calculator

A simple command-line calculator application built with Python.

Features

  • Basic arithmetic: addition, subtraction, multiplication, division
  • Expression evaluation: supports complex mathematical expressions
  • Power operations: use ^ or ** for exponents
  • Parentheses: full support for nested expressions

Usage

Run the calculator with the --eq flag:

python main.py --eq "5 + 3"
python main.py --eq "10 * (2 + 3)"
python main.py --eq "2 ^ 8"

Project Structure

  • main.py - CLI application entry point
  • lib/ - Library modules
    • calculator.py - Core calculator logic
  • tests/ - Test files

Examples

| Expression | Result | |------------|--------| | 5 + 3 | 8 | | 10 - 4 | 6 | | 6 * 7 | 42 | | 15 / 3 | 5.0 | | 2 ** 10| 1024 |

💡 Tip: Use the Args input field in the editor toolbar to pass command line arguments!

Output

Output will appear here

Click Run to execute code

AI Assistant

Pyodide ready

Hi! I'm your playground assistant. I can help you create files, write Python code, and run it in the browser. What would you like to build?

Enter to send · Shift+Enter for new line