###📌 Problem
When using the calculator script, the program crashes if the user tries to divide by zero.
💥 Steps to Reproduce
- Run calculator.py
- Choose the division operation
- Enter any number (e.g., 10) and then 0
❗Actual Behavior
Program crashes with a ZeroDivisionError
.
✅ Expected Behavior
The script should catch this error and show a user-friendly message like:
"Error: You cannot divide by zero."
🛠️ Suggested Fix
Wrap the division operation in a try-except block to catch ZeroDivisionError
.
try:
result = a / b
except ZeroDivisionError:
print("Error: Cannot divide by zero.")