AtomLearnAtomLearn
DashboardGoalsPathAchievementsReviewSign In
Python CoreNot Started

Python Syntax

Indentation, f-strings, list/dict comprehensions, unpacking

0%
Knowledge0%
Learn & Drill
Fluency0%
Drill & Speed
Retention0%
Mastery & Review
Confidence0%
All modes
Practice
Knowledge
Fluency
Retention

Knowledge Debt detected

You can study this freely — but your score may plateau if these foundations have gaps. The Mastery badge requires them to be solid.

Explanation

Python has unique syntax features that distinguish it from other languages.

Indentation defines code blocks (no braces needed). :f-string[A string literal prefixed with 'f' that can embed Python expressions in curly braces]s make string formatting readable: ``python name = "Alice" print(f"Hello, {name}!") # Hello, Alice!

:list-comprehension[A concise way to create lists by iterating over a sequence in a single expression]s — concise loops: ``python squares = [x**2 for x in range(5)] # [0, 1, 4, 9, 16]

:unpacking[Assigning multiple variables from a collection in one statement using destructuring]

python a, b, c = [1, 2, 3] first, *rest = [1, 2, 3, 4, 5]

Examples

Dict comprehension

Build a dict from a list in one line

words = ["apple", "bat", "cherry"]
lengths = {w: len(w) for w in words}
print(lengths)  # {'apple': 5, 'bat': 3, 'cherry': 6}

How well did you understand this?

Next in Python Core

Exceptions & Error Handling

Continue