Solved

Stage 1 — KeyError when mass_kg is missing

EmmaCodesOP edited

My negative mass check crashes for the record without mass.

11

Comments 4

Join the discussion

Already have an account? Log in

  1. MateoG Solutionreplies: 2

    Check that the key exists before comparing. Combine the two conditions with and — Python stops evaluating at the first False, so the comparison never runs when the key is missing.

    6
    1. JackStack

      Returning a list of problems instead of stopping at the first is a great UX pattern. Users can fix everything in one go.

      0