What Does the Code Print?

🐍 What Does the Code Print?

A few lines of Python. What comes out?

Read a short piece of Python and pick what it prints. You don't need to know coding, just arithmetic. But there are traps: list positions start at 0, range leaves out its end number, and reassigning a variable wipes the old value. Every miss is explained line by line.

About this quiz

The first skill you build when learning to code is following in your head what a piece of code will do. Here you train it by reading short Python snippets and predicting the output.

The first three cover basics like arithmetic, string length and list positions. After that come conditions, loops and reassignment. The numbers change every round, so memorising won't help.

At a glance

Questions
10
Subject
Coding
Price
Free
Sign-in
Optional
Devices
Phone, tablet, desktop

How to play

Lists start at 0
In nums = [3, 5, 7], nums[1] is 5. The first slot is number 0, so positions are one less than the way people count.
range skips its end
range(1, 5) gives 1, 2, 3, 4. The 5 isn't included, and half the loop questions hinge on that.
Review only what you missed
Under your result you'll find each question you missed, what you picked, the right answer and the working. Finish a round and your review is done too.

Score ranks

  • Human Interpreter

    No trap got you. You run code in your head.

  • Debugging Fairy

    Nearly perfect. Just remember one more time that lists count from 0.

  • Coding Beginner, Unlocked

    The arithmetic is solid. Only range and reassignment wobbled.

  • Making Friends With Bugs

    Everyone meets bugs at first. Read the explanations and play again.

Frequently asked questions

Do I need to know how to code?
Yes. If you can do arithmetic you can play, and every miss is explained line by line.
Why Python?
It's one of the most common languages in school coding classes and beginner courses. The ideas carry over to almost every other language.
Do I get the same questions every time?
Every round is generated fresh. Only a friend's challenge link gives you the same questions in the same order.