This project was developed for academic purposes and serves as a simple calculator implemented in Python. It offers basic mathematical operations such as addition, subtraction, multiplication, and division. The user can choose an operation, input two numbers, and get the result. The calculator also checks for division by zero to prevent errors.
The program offers the following functionalities:
- Addition of two numbers
- Subtraction of two numbers
- Multiplication of two numbers
- Division of two numbers (with division by zero check)
- Option to exit the program
-
When the program starts, the available operations are displayed:
1
- Addition2
- Subtraction3
- Multiplication4
- Division5
- Exit the program
-
The user selects the desired operation by entering the corresponding number.
-
The program then asks the user to input two numbers to perform the operation.
-
The result of the operation is displayed.
-
The user can repeat the process or choose
5
to exit the program.
1 - Addition
2 - Subtraction
3 - Multiplication
4 - Division
5 - Exit the program
Choose your option: 1
Enter a number (N1): 10
Enter a number (N2): 20
30.0
- The calculator checks for division by zero and displays an appropriate error message.
- Python 3.x
- Clone or download the repository.
- Open a terminal and navigate to the directory where the code is located.
- Run the script with the command:
python name_of_the_file.py