Solved

Stage 2 — ValueError from an f-string?

MateoGOP

I didn't know f-strings could throw ValueError. The line has curly braces from the JSON.

0

Comments 4

Join the discussion

Already have an account? Log in

  1. TomBecker Solutionreplies: 2

    Inside an f-string, { starts a placeholder. Python tries to read "status": ... as an expression with a format spec and fails. Literal braces need to be doubled — that's the hint for this stage.

    8
    1. MateoGOPreplies: 1

      Doubled braces, and now it prints the JSON. Ugly but works.

      3
      1. FreyaL

        Agreed, but this is a good lesson in why hand-made JSON is fragile.

        1
    2. SamPrice

      For real JSON, build a dict and use json.dumps() instead of assembling text by hand. The "JSON out" challenge covers it.

      2