read_number_line(path) that opens a file, parses its first line as a float and returns ('ok', value) — but returns ('missing', None) if the file doesn't exist and ('invalid', None) if parsing fails. Use try's <code>else</code> clause so the parse only counts as "ok" when no exception occurred in the open/read step being guarded.read_number_line('temp.txt') # first line '36.6'('ok', 36.6)File present and parseable.
try/except FileNotFoundError, except ValueError, else: return ok.
The else branch runs only when nothing raised.