Solved

Bare except hid a typo — scary

EmmaCodesOP

Stage 2 revealed a NameError that had been hidden all along. Every reading was "bad" because of a typo.

1

Comments 4

Join the discussion

Already have an account? Log in

  1. AmeliaRuns Solutionreplies: 2

    That's exactly why bare except: is dangerous: it catches everything, including programming mistakes and even Ctrl+C (KeyboardInterrupt). Catch only the errors you expect from that line — here ValueError from float().

    6
    1. EmmaCodesOPreplies: 1

      I've definitely written bare excepts in my own scripts. Going back to fix them.

      0
    2. CharlieH

      except Exception as error: print(error) is a useful temporary debugging step, like stage 2 does, to see what's really going on.

      2