An expression is a Python construct evaluated to produce a value. It can transform each item in a comprehension or appear inside an f-string, where Python evaluates it while formatting the string. section 7.5 section 1.6
[x*x #1 for x in range(10) #2 if x%2 == 0] #3
This comprehension uses x*x as its transformation expression and keeps only even values with an if condition. section 7.5
Comprehensions combine transformation and filtering. Their map and filter equivalents separate those jobs: map changes every input while filter decides which original elements remain. section 7.5 section 7.5
Expressions inside formatted strings
name = 'world' x = 100 y = 'abcd' f'x * 2 = {x*2}, and y.capitalize() is {y.capitalize()}' The braces contain expressions, not merely variable names, so arithmetic and method calls are evaluated during formatting. section 1.6










