Skip to content

Interactive Python calculator for basic arithmetic operations with clean input validation, user-friendly prompts, and session history tracking. Ideal for beginners learning Python functions, loops, and error handling.

Notifications You must be signed in to change notification settings

Birendra-DS/Python-Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

🧮 Python Calculator Project

A simple and user-friendly command-line calculator built using Python.
This project demonstrates basic programming concepts including functions, loops, error handling, input validation, and data storage with calculation history tracking.

Features

  • Perform addition ➕, subtraction ➖, multiplication ✖️, and division ➗ with zero-check handling
  • Interactive menu-driven interface with clear prompts and informative messages
  • Prevents crashes by validating user input and handling invalid data gracefully
  • Keeps a session-long history of all calculations, accessible anytime
  • Option to quit anytime with a polite goodbye message

Prerequisites

  • Python 3.x installed on your system
  • No additional libraries required

How to Run

  1. Clone this repository or download the source code
  2. Open your terminal or command prompt
  3. Navigate to the project directory
  4. Run the calculator script with:
    Calculator_project.py
    
    

Example usage

🙏Welcome to the world best precise calculator_ 1.Addition (➕) 2.Subtraction(➖) 3.Multipication( ✖️ ) 4.Division(➗)

Enter your choice (➕ ➖ ✖️ ➗(/)), h for history or q for quit:+ Enter 1st number:10 Enter 2nd number:90 10.0 + 90.0 = 100.0

⁉️___Do you want to do more calculation?___⁉️ Enter your choice(Yes/No):yes

Enter your choice (➕ ➖ ✖️ ➗(/)), h for history or q for quit:- Enter 1st number:100 Enter 2nd number:50 100.0 - 50.0 = 50.0

⁉️___Do you want to do more calculation?___⁉️ Enter your choice(Yes/No):yes

Enter your choice (➕ ➖ ✖️ ➗(/)), h for history or q for quit:* Enter 1st number:20 Enter 2nd number:25 20.0 * 25.0 = 500.0

⁉️___Do you want to do more calculation?___⁉️ Enter your choice(Yes/No):yes

Enter your choice (➕ ➖ ✖️ ➗(/)), h for history or q for quit:h 🤔 History of your calculation 1➡️ You did this --> 10.0 + 90.0 = 100.00 2➡️ You did this --> 100.0 - 50.0 = 50.00 3➡️ You did this --> 20.0 * 25.0 = 500.00

Enter your choice (➕ ➖ ✖️ ➗(/)), h for history or q for quit:yes ❌Invalid choice. Please choose correct choice

Enter your choice (➕ ➖ ✖️ ➗(/)), h for history or q for quit:q Thanks for using our calculator 👋Good bye! see youe again💞

Future Enhancements

  • Add scientific functions (trigonometry, logarithms)
  • Save and load calculation history to a file
  • Support input of complex expressions
  • Develop a graphical user interface (GUI)

About the Author

Birendra Paul is a passionate data science student with a keen interest in Python programming and machine learning.
Dedicated to continuous learning, Birendra enjoys building projects that enhance practical skills and help support educational goals.

Connect with Birendra on:

Feel free to reach out for collaboration, feedback, or mentorship!

About

Interactive Python calculator for basic arithmetic operations with clean input validation, user-friendly prompts, and session history tracking. Ideal for beginners learning Python functions, loops, and error handling.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages