Skip to content

About

A simple command-line calculator built with Python.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

🧮 Python Calculator

A simple command-line calculator built with Python.

This project supports basic arithmetic operations and includes input validation, error handling, and the ability to continue calculations using the previous result.

✨ Features

  • ➕ Addition
  • ➖ Subtraction
  • ✖️ Multiplication
  • ➗ Division
  • 🔢 Decimal number support
  • 🛡️ Input validation
  • ⚠️ Division-by-zero protection
  • 🔄 Continue calculations using the previous result
  • 🧹 Console clearing between sessions
  • ❌ Invalid input handling

🛠️ Built With

  • Python 3
  • Built-in os module

📂 Project Structure

python-calculator/
│
└── main.py

🚀 How to Run

Make sure Python 3 is installed on your system.

Clone the repository:

git clone https://github.com/Ramtinexe/python-calculator.git

Navigate to the project folder:

cd python-calculator

Run the program:

python main.py

🎮 How It Works

  1. Enter the first number.

  2. Choose an operation:

    • + Addition
    • - Subtraction
    • * Multiplication
    • / Division
  3. Enter the second number.

  4. The calculator displays the result.

  5. Choose whether to:

    • Continue calculating with the previous result.
    • Start a new calculation.

📚 What I Learned

This project helped me practice several Python concepts:

  • Functions
  • Return values
  • Dictionaries
  • Dictionary of functions
  • while loops
  • Nested loops
  • if / elif / else
  • break and continue
  • try / except
  • Input validation
  • Error handling
  • Basic file/system operations with os

👤 Author

Ramtin

GitHub: https://github.com/Ramtinexe


⭐ If you found this project useful, feel free to give it a star!

About

A simple command-line calculator built with Python.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages