The Exception Handler
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L3
Problem
Given a list of [numerator, denominator] operations, for each return: numerator / denominator as float on success; 'division by zero' when denominator is 0; 'invalid input' when either operand is not numeric. Return the results as a list.
Summary
Good code handles failure as gracefully as success.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.