This is a basic command-line calculator program written in Python. It's a straightforward tool that allows users to perform fundamental arithmetic operations: addition, subtraction, multiplication, and division. The code is simple, easy to understand, and suitable for beginners learning Python.
- Addition (+): Adds two numbers.
- Subtraction (-): Subtracts the second number from the first.
- Multiplication (*): Multiplies two numbers.
- Division (/): Divides the first number by the second. Includes a check to prevent division by zero.
- User-Friendly Interface: Provides a simple menu for selecting an operation.
- Input Validation: Handles non-numeric input gracefully with an error message.
- Continuous Calculations: Allows the user to perform multiple calculations in a single session.
- Prerequisites: Ensure you have Python 3 installed on your system.
- Clone the Repository:
(Replace
git clone [https://github.com/YourUsername/your-repository-name.git](https://github.com/YourUsername/your-repository-name.git) cd your-repository-nameYourUsernameandyour-repository-namewith your actual GitHub details.) - Run the script:
python calculator.py
- Start the program by running the
calculator.pyfile. - A menu will appear asking you to select an operation (1-4).
- Enter your choice and press Enter.
- The program will then prompt you to enter the first and second numbers.
- After the result is displayed, you will be asked if you want to perform another calculation.
- Type
yesto continue ornoto exit the program.