Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 1.22 KB

File metadata and controls

49 lines (39 loc) · 1.22 KB

Basic Calculator Program

Description

A simple Python calculator that performs basic arithmetic operations (addition, subtraction, multiplication, and division) on two user-input numbers.

Features

  • Takes two numbers as input
  • Supports four operations: +, -, *, /
  • Handles division by zero error
  • Provides clear output showing the operation and result
  • User-friendly prompts

Requirements

  • Python 3.x

Installation

No installation required. Just run the Python script directly.

Usage

  1. Run the program:
    python calculator.py
  2. Follow the on-screen prompts:
    • Enter the first number
    • Enter the second number
    • Choose an operation (+, -, *, /)

Example

$ python calculator.py
Enter the first number: 10
Enter the second number: 5
Enter the operation (+, -, *, /): +
10.0 + 5.0 = 15.0

Error Handling

  • Displays error for invalid operations (anything other than +, -, *, /)
  • Prevents division by zero with appropriate error message

License

This project is open source and free to use.

Contributing

Contributions are welcome! Please fork the repository and submit a pull request.

Contact

For questions or feedback, please open an issue in the repository.