Check yourself

0 of …

Answer without scrolling back up.

  1. 7 / 2 in Python 3 gives:

  2. 7 % 3 evaluates to:

  3. 2 ** 10 evaluates to:

Cheat sheet

Numbers and Operators

Older languages gave you one division that returned a whole number, quietly throwing away the fraction. Python 3 decided that was a silent bug factory: true division / keeps the fraction and answers in float; floor division // is the "whole-number division" people were actually reaching for — useful for splitting a list into equal chunks, or turning seconds into minutes.

PYTHON · AI.Cruz.in/python/numbers_and_operators.html

About the author

AI.Cruz builds and maintains AI.Cruz. Every module here is written and the visualisation behind it hand-built, so the numbers in a readout come from the same code that draws the picture. Corrections are genuinely welcome and get priority over everything else — if a page states something wrong, or an animation misrepresents what the algorithm does, get in touch.