Skip to content

A simple calculator in Python is a program that allows the user to perform basic arithmetic operations such as addition, subtraction, multiplication, and division. The user is prompted to select an operation and provide two numbers. Based on the user's choice, the program then performs the operation and displays the result.

Notifications You must be signed in to change notification settings

rohithds/Simple-Python-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Here's an example of a README file tailored for your Simple Calculator Python project:

Simple Calculator in Python A simple command-line calculator built in Python that performs basic arithmetic operations such as addition, subtraction, multiplication, and division. This project is ideal for beginners learning Python and how to work with functions, user input, and basic error handling.

Features 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. Requirements Python 3.x (Recommended version: Python 3.6 or higher) Installation Clone this repository to your local machine:

bash Copy code git clone https://github.com/your-username/simple-calculator.git Navigate into the project directory:

bash Copy code cd simple-calculator No additional installations or dependencies are required to run the calculator. The program runs with Python's built-in modules.

Usage Run the Python script calculator.py:

bash Copy code python calculator.py The program will display a menu with the available operations:

markdown Copy code

  1. Add
  2. Subtract
  3. Multiply
  4. Divide Enter the number corresponding to the operation you'd like to perform.

Enter two numbers when prompted, and the program will display the result of the chosen operation.

Example: mathematica Copy code Welcome to the Python Calculator! Select operation:

  1. Add
  2. Subtract
  3. Multiply
  4. Divide Enter the operation (1/2/3/4): 1 Enter the first number: 10 Enter the second number: 5 10 + 5 = 15 Error Handling Division by Zero: If you attempt to divide by zero, the program will display an error message:

vbnet Copy code Error! Division by zero. Invalid Input: If the user enters an invalid operation or an invalid number, the program will guide them to enter valid data.

Contributing Feel free to fork this repository, create issues, and submit pull requests. Contributions are welcome!

Steps to Contribute: Fork this repository to your GitHub account. Clone the forked repository to your local machine. Create a new branch for your feature or fix. Make the necessary changes. Push your changes back to your forked repository. Open a pull request to the main repository. License This project is licensed under the MIT License - see the LICENSE file for details.

Author Rohith Doddamane(Roy)

About

A simple calculator in Python is a program that allows the user to perform basic arithmetic operations such as addition, subtraction, multiplication, and division. The user is prompted to select an operation and provide two numbers. Based on the user's choice, the program then performs the operation and displays the result.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published