A simple command-line calculator built in Python that supports multi-number input, advanced operations, and maintains calculation history.
- Supports operations:
- Addition
+ - Subtraction
- - Multiplication
* - Division
/ - Power
^ - Percentage
% - Square root
sqrt
- Addition
- Commands:
historyโ Show past calculationsclearโ Clear historyexitโ Quit the calculator
- Saves history to a
history.txtfile
- Make sure Python is installed.
- Open a terminal in your project directory.
- Run the app:
- python calculator.py
Enter operator or command: +
Enter numbers: 10 20 30
10 + 20 + 30 = 60
Enter operator or command: sqrt
Enter a number: 25
โ25 = 5
- ^ (power) and % (percentage) require exactly 2 numbers.
- sqrt only accepts a single positive number.
- All operations are rounded to 3 decimals if needed.
- The history file can be excluded from version control using .gitignore.
Here are some features planned or suggested for future versions:
โ GUI Version using Tkinter
-
User-friendly interface with buttons and display
-
Input fields for numbers and operations