GUIDEDeep dive
How to Read Python Output
Output questions ask you to evaluate by Python rules. Check operator precedence, then types (int/str/list), and write the answer in repr form; strings carry quotes and lists/dicts keep literal syntax.
Precedence
** binds tighter than * / // %, which bind tighter than + -.
Comparisons and and/or bind looser than arithmetic.
Types
1/2 is a float; 1//2 is an int.
String + only concatenates strings.
FAQ
Why are strings quoted?
repr includes quotes to distinguish strings from names.
Lists vs tuples?
Lists use []; tuples use (), and one-element tuples need a comma.
Sources
Related calculators
Python Output: 1000 Gamified Expression and Method Cards1000 Python output cards covering arithmetic, strings, lists, dicts, comprehensions and built-ins, in 50 levels with spaced repetition.More guides
Hiragana vs KatakanaRead guideSpaced Repetition and the Forgetting CurveRead guideOn Readings vs Kun ReadingsRead guideAn N5 Kanji Study OrderRead guideKEEP READING
Keep reading
Read in order, or jump to another guide on the same topic.
← PreviousSQL JOIN and GROUP BYJoining two tables, aggregate groups and HAVING.Next →List and Dict Output: Slices, Comprehensions, getSlice bounds, list comprehensions, dict keys and get defaults.