P47PythonBeginnerDesign10 min
Define a Function Contract for a Revenue Parsing Helper
Design input, output, and edge-case behavior for a messy revenue parsing helper.
#design#functions#parsing
Scenario
Revenue values arrive as '$1,250.00', ' 850 ', '', and 'unknown'. Analysts need numeric values without silently inventing revenue.
Problem statement
Define a clear function contract before implementing it.
Your Task
- Specify accepted inputs and output type.
- Choose behavior for blanks and invalid text.
- State how callers can distinguish invalid from zero.
Related Concepts
Function contractsMissing valuesParsing
Ready to count this problem?
Mark it complete when you have reasoned through the solution in your own words.