Community member
OllieGrant
Member since May 2025 · last post 24 Oct, 13:43
- 12 threads
- 44 comments
- 9 solutions
- 193 upvotes received
Counts public posts in this language only.
Latest threads
Latest comments
-
In zip() silently dropping data scared me Solution
Yes, that's a real-world trap. Since Python 3.10 you can use zip(..., strict=True), which raises an error when lengths differ. The challenge asks for an explicit len() check and warning, which is also nice for the user.
-
In Stage 2 — removing the length check feels wrong
One except for two problems. Clean.
-
Same trap as the hint says: format the value, don't change it.
-
In Stage 2 — why is K to F refused? Solution
It's not in the table, and the challenge's point is that the converter only does conversions it explicitly knows. Refusing with a clear error is safer than guessing. You could add it via Celsius, but that's beyond what…
-
In Hidden tests plant bugs — how does that work?
The checker runs your asserts against deliberately broken versions of the functions (like >= instead of >). If your tests still pass on a broken version, they didn't catch the bug. So you need tests on the exact boundar…
-
In Percent with two decimals in a fixed-width column
"text".center(WIDTH) for the title is neat. Didn't know strings had center().
-
In "too many values to unpack" in stage 2
Star unpacking is so useful with CSV rows.
-
In UnboundLocalError: local variable referenced before assignment Solution
It can read count, but count += 1 is an assignment, and any assignment inside a function makes that name local to the whole function. So Python treats count as local, and it has no value yet when += tries to read it. Be…
-
In KeyError when reading a key that may not exist
Or check first: if "timeout" in config:. .get() is usually shorter.
-
In The fifth bug — runs but wrong decision Solution
Look at how the decision variable gets updated in the loop. A common bug is overwriting it for each sensor, so only the last sensor decides. Any out-of-range reading should make it NO GO and nothing should set it back.