# Calculator CLI - Tasks for Webber A simple calculator with intentional bugs and missing features for testing Webber's capabilities. ## Bugs to Fix ### High Priority - [ ] **Division by zero** - `operations.py:divide()` crashes when dividing by zero instead of returning an error - [ ] **Invalid operation name** - `main.py:get_operation()` raises KeyError for unknown operations instead of helpful error message ### Medium Priority - [ ] **Power function broken** - `operations.py:power()` doesn't handle negative exponents or fractional exponents correctly - [ ] **No input validation** - `main.py` doesn't validate that command-line arguments are valid numbers ## Missing Tests - [ ] Add `TestDivide` class with tests for: - Normal division - Division by zero (should test error handling once bug is fixed) - Division with negative numbers - [ ] Add `TestPower` class with tests for: - Positive integer exponents - Zero exponent (should return 1) - Negative exponents - [ ] Complete existing test classes: - `test_add_zero` - `test_add_floats` - `test_subtract_negative` - `test_multiply_by_zero` ## Features to Add - [ ] **Expose power operation** - Add 'pow' to the operations dictionary in `main.py` - [ ] **Add modulo operation** - Implement `modulo(a, b)` in operations.py - [ ] **Add --verbose flag** - Show step-by-step calculation - [ ] **Add history command** - Track and display recent calculations - [ ] **Add REPL mode** - Interactive calculator loop ## Code Quality - [ ] Add type hints to all functions - [ ] Add docstrings following Google style - [ ] Fix any linting errors (run `ruff check src/`) ## How to Run ```bash # Setup python3.12 -m venv .venv source .venv/bin/activate pip install -r requirements.txt # Run calculator python -m calculator.main 10 5 add python -m calculator.main 10 5 div # Run tests pytest tests/ -v # See failing tests (division by zero) python -m calculator.main 10 0 div ```