Your task for today is to create a simple calculator in Python that can perform basic mathematical operations. This project introduces you to functions, user input handling, and basic program flow control.
Project Task
Create a calculator program that:
Displays a menu of available operations (+, -, *, /, %)
Takes two numbers as input from the user
Performs the selected operation
Displays the result in a formatted way
Allows the user to perform multiple calculations
Handles invalid input gracefully
Bonus (optional):
Add more advanced operations (square root, power, factorial)
Keep a history of calculations
Add input validation for division by zero
Create a simple graphical interface
This project gives you hands-on practice with functions, user input, conditionals, and loops — fundamental building blocks of programming.
Expected Output
🧮 Simple Calculator
==================
Choose an operation:
1. Addition (+)
2. Subtraction (-)
3. Multiplication (*)
4. Division (/)
5. Modulus (%)
6. Exit
Enter your choice (1-6): 1
Enter first number: 15
Enter second number: 25
Result: 15 + 25 = 40
Do you want to perform another calculation? (y/n): y
Choose an operation:
1. Addition (+)
2. Subtraction (-)
3. Multiplication (*)
4. Division (/)
5. Modulus (%)
6. Exit
Enter your choice (1-6): 4
Enter first number: 20
Enter second number: 4
Result: 20 / 4 = 5.0
Do you want to perform another calculation? (y/n): n
Thank you for using the calculator! 👋
Join the Python & AI Builders Skool Community
Got questions to ask the author about this project? Join our Python & AI builders community for weekly videos and discussions:
💻 Launch This Project in Colab
Open the interactive Google Colab notebook for today’s project — with full instructions, hints, and solutions.
Click the button below to start coding — no setup needed: