Home / Projects / Modular Calculator
Day 4 · Day 4: Functions & Modules

Modular Calculator

Build a calculator program organized into separate functions for each arithmetic operation, with proper error handling for invalid input and division by zero.

Requirements

1. Write separate functions: add, subtract, multiply, divide.
2. Each function takes two numbers and returns the result.
3. The divide function must handle division by zero gracefully (return an error message, not crash).
4. Build a menu loop that asks the user to choose an operation and enter two numbers.
5. Validate that user input is numeric using try/except.
6. Allow the user to perform multiple calculations until they choose to exit.
50 XP on completion Back to Day 4

Your Code

Output
Click "Run" to execute your code...

Log in to mark this project complete and earn XP.