๐งฎ Simple Calculator
A beginner-friendly yet powerful command-line calculator built in Python. This project showcases clean coding practices, error handling, and user input validation while performing basic arithmetic operations.
๐ Features
โ Addition
โ Subtraction
โ๏ธ Multiplication
โ Division (with zero-division handling)
๐ฆ Square of a number
๐ Project Structure Simple-Calculator/
โโโ calculator.py # Main program file
โโโ README.md # Project documentation
โ๏ธ How It Works
User enters the first number.
Chooses an operation: +, -, *, /, or ^2.
If an operation requires two numbers, the user is prompted for the second number.
The result is displayed with proper handling of invalid inputs and division by zero.
๐ป Example Run
Enter number: 10
Enter operation(+,-,*,/,^2): *
Enter 2nd number: 5
Answer: 50
Another run with squaring:
Enter number: 7
Enter operation(+,-,*,/,^2): ^2
Answer: 49
๐ก Error Handling
Prevents division by zero
Catches invalid operations and guides the user
๐ฏ Skills Demonstrated
Python fundamentals (loops, conditionals, operators)
Input handling & validation
Exception handling (ZeroDivisionError)
Writing clean, readable, and structured code
๐ฎ Future Improvements
Add support for power (^) and square root (โ)
Implement a menu-driven interface instead of single input prompts
Extend to a GUI version using Tkinter or PyQt
๐ค Contributing
Want to improve this project? Fork the repo, make changes, and submit a pull request!
๐ License
This project is licensed under the MIT License โ feel free to use and improve it.