Skip to content

Glodykajabika/Python-basic-calculator-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Python-basic-calculator-project

A clean, beginner-friendly console-based calculator built with Python. This project performs basic arithmetic operations — addition, subtraction, multiplication, and division — while handling common errors gracefully.

Perfect for learning core Python concepts like user input, conditionals, loops, type conversion, and basic error handling.

Features

  • Add, subtract, multiply, and divide two numbers
  • Supports both integers and decimal (floating-point) numbers
  • Prevents division by zero with a friendly error message
  • Handles invalid inputs (e.g., letters instead of numbers)
  • Option to perform multiple calculations in one session

Concepts Practiced

  • input() and print()
  • Type conversion (int())
  • Conditional statements (if-elif-else)
  • Loops (while)
  • Error handling (try-except, ValueError, ZeroDivisionError)
  • f-strings and output formatting
  • Basic program flow and user experience

How to Run

  1. Make sure you have Python 3 installed
  2. Clone or download this repository
  3. Open terminal/command prompt in the project folder
  4. Run the script:
python calculator.py

(Or whatever you named the file — e.g., python main.py)

Example Usage

Enter first number: 15.5
Enter second number: 4
Choose operation (+, -, *, /): /
15.5 / 4 = 3.875

Do you want to calculate again? (y/n): n
Thanks for using the calculator!

Future Improvements (Ideas)

  • Add support for more operations (%, **, sqrt)
  • Include a calculation history
  • Build a GUI version with Tkinter
  • Add keyboard shortcuts or menu navigation

License

MIT License — feel free to use, modify, and share!

Made with love by [Your Name] — learning Python one project at a time!

Happy coding!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages