Challenge
Clear error messages
…with a message that shows the bad value, then raise TypeError, checked first, when the length isn't a number at all.
Showing 1–10 of 12
Challenge
…with a message that shows the bad value, then raise TypeError, checked first, when the length isn't a number at all.
Challenge
code[0] = "X" stops with a TypeError, because Python strings can't be changed. Predict the crash, find out what methods and slices really give, build a new string instead, then swap a letter in the…
Challenge
A crew count read with input() crashes when 1 is added to it. Predict the crash, find out what input() really returns, fix it with int(), then write a packing tool that reads two numbers.
Challenge
A status line crashes with a TypeError because it joins text and a number with +. Predict it, read the error, fix it with str(), then build a docking status line.
Challenge
A 40-line pre-burn check has five bugs: a syntax error, a type error, a wrong key, an index out of range and a reversed decision. Read each error to fix the four that crash, then find the one that…
Challenge
A Python program stops with a traceback. Read it from the bottom up to find the error, the function and the line, fix the bug there, then follow a longer traceback through four calls to a second bug.
Challenge
…of a number, and the check from "Alert level" stops with a TypeError in the middle of a pass. Extend your check so a missing reading is reported, not crashed on, then handle missing values in the…
Challenge
…but response_text is text, and the program stops with TypeError: string indices must be integers . Turn the text into a dict with json.loads() , then add a line for crewed : Launch: Lumen-3 Provider…
Challenge
…a version that doesn't raise at all, and one that raises TypeError instead; your check must fail on both. The message, and what must still work A function that refuses everything would pass your test…
Challenge
…, so a bug such as parse_pressure(None) still raises its TypeError . The loop prints: 101.2 None 100.8