This repository contains a simple command-line interface (CLI) calculator implemented in Python. The calculator supports basic arithmetic operations such as addition, subtraction, multiplication, and division.
- Addition: Adds two numbers.
- Subtraction: Subtracts the second number from the first.
- Multiplication: Multiplies two numbers.
- Division: Divides the first number by the second, with error handling for division by zero.
-
Clone the repository:
git clone https://github.com/CodeByTomas/simple_cli_calculator.git cd simple_cli_calculator -
Run the calculator with uv:
uv run cli_python_calculator.py
-
Follow the on-screen prompts to select an operation and input numbers.
Simple CLI Calculator by @CodeByTomas
Select operation:
1. Add
2. Subtract
3. Multiply
4. Divide
Enter choice(1/2/3/4): 1
Enter first number: 5
Enter second number: 3
Result: 8.0add(x, y): Returns the sum ofxandy.subtract(x, y): Returns the difference ofxandy.multiply(x, y): Returns the product ofxandy.divide(x, y): Returns the quotient ofxandy. Ifyis 0, returns an error message.
This project is licensed under the MIT License. See the LICENSE file for details.