Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

python-calculator

Simple Python Calculator

This is a basic command-line calculator program written in Python. It allows users to input two numbers and perform one of four mathematical operations: addition, subtraction, multiplication, or division. The result of the operation is displayed to the user.

Features

Accepts two numerical inputs from the user.

Supports the following operations:

Addition (+)

Subtraction (-)

Multiplication (*)

Division (/)

Includes error handling for division by zero.

Displays the result in a clear and user-friendly format.

Requirements

Python 3.x

How to Use

Clone or download this repository to your local machine.

Open a terminal or command prompt.

Navigate to the directory containing the program file.

Run the program using Python:

bash python calculator.py Follow the prompts to:

Enter the first number.

Enter the second number.

Choose an operation (+, -, *, or /).

View the result of the operation.

Example bash Enter the first number: 10 Enter the second number: 5 Enter the operation (+, -, *, /): + 10 + 5 = 15

Error Handling

If division by zero is attempted, the program will display an error message: "Error: Division by zero is not allowed!"

If an invalid operation is entered, the program will display: *"Invalid operation. Please use one of +, -, , or /."

Customization Feel free to modify the program to include additional features, such as:

Support for more operations (e.g., exponentiation, modulus).

Input validation to handle non-numeric inputs gracefully.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages