Quiz
Python Error Messages Quiz
Free beginner quiz: 15 Python errors to read and fix – NameError, TypeError, ValueError, IndexError, KeyError, IndentationError and ZeroDivisionError.
Showing 1–10 of 55
Quiz
Free beginner quiz: 15 Python errors to read and fix – NameError, TypeError, ValueError, IndexError, KeyError, IndentationError and ZeroDivisionError.
Challenge
…fuel_needed() about a burn of -5 seconds, after a sign error somewhere upstream, and got back -62.5 kg. Nobody noticed until the fuel budget came out 62.5 kg short. A function that gets a value it…
Challenge
…from a typo. Predict the last line, find the hidden error, catch only ValueError and fix the typo, then write a parser that lets other errors through.
Challenge
…so a version that returns a value or raises the wrong error fails it, then pin down the message and the lengths that must still work.
Challenge
The flight log script won't run. Read the error message, go straight to the line it names and fix it. Learn to debug Python syntax errors the way programmers do.
Challenge
Scan the mission log for the first ERROR entry, print its line number with enumerate() and stop there with break, then report how many lines were checked, or that there were no errors at all.
Challenge
…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
…Python refuses to run it. Predict what happens, fix both errors one after the other, then write an if/else check yourself.
Article Mini projects
…data with a graphical interface, database operations, and error handling.
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…