Python Error Messages Quiz
Free beginner quiz: 15 Python errors to read and fix – NameError, TypeError, ValueError, IndexError, KeyError, IndentationError and ZeroDivisionError.
- Questions: 15
- Easy
- Free account needed
Change one line, press Run and see what happens. Nothing to install and no account needed.
Press Run to see the output here.
Replace "You" with your name, then add one more seat. Open the full editor →
Discover the latest in space science and Python programming. Our newest articles blend astronomy concepts with coding challenges to fuel your cosmic curiosity.
AI now writes a large share of new code, so is learning Python still worth your time? Yes, but for a different reason than ten years ago. Using job data, developer surveys and recent studies on learning with AI, we look at what changed and where Python’s
Learn to write your own Python functions, from your first def to return values, default parameters and scope, with runnable examples, common mistakes and six practice projects.
In Project Hail Mary, the alien engineer Rocky counts in base 6 because he has two hands with three fingers each. In this article, you'll build Python programs that convert between decimal, base-6, and Eridian notation.
Questions and answers from other people learning Python.
A different quiz every Monday. How many will you get right?
Free beginner quiz: 15 Python errors to read and fix – NameError, TypeError, ValueError, IndexError, KeyError, IndentationError and ZeroDivisionError.
Three challenges, different every day. Fix or write the code and let the tests check it.
Add up the cargo mass of each category into a dict with totals[category] = totals.get(category, 0) + mass, then list the categories from heaviest to lightest with their share of the load.
Count the mission log's entries per level, INFO, WARN and ERROR, in a dict of counters, then count any level at all with get() when DEBUG lines turn up, and print the levels in alphabetical order.
Replace a nine-branch elif that maps planets and the Moon to surface gravity with a dict and one get() lookup, keeping the output exactly the same, then loop over the dict for a weight table.
Three short programs to read, run and change. A new set tomorrow.
The global keyword allows modifying a global variable inside a function.
The nonlocal keyword gives access to variables in the enclosing function.
Namespaces isolate variables. Modules and functions create their own namespaces.
A free account saves your progress on paths, quizzes and challenges, keeps the code you write, and lets you ask and answer in the community.