🧮 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.