#import "@local/template:0.1.0": * #show: template.with( Title: [Python Progress], author: "Miled Martínez Fadul", year: 2026, month: 7, day: 21, lang: "python", book: false ) = Language Reference == 2. Lexical analysis === 2.1. Line structure ==== 2.1.3 Comments ``` # This program says hello and asks for a name. ``` === 2.5. String and Bytes literals ==== 2.5.4. Escape sequences¶ Unless an `r` or `R` prefix is present, escape sequences in string and bytes literals are interpreted according to rules similar to those used by Standard C. The recognized escape sequences are: #table( columns: 2, table.header([Operation], [Meaning]), [`\`], [Ignored end of line], [`\\`], [Backslash], [`\'`], [Single quote], [`\"`], [Double quote], // [`\a`], [ASCII Bell (BEL)], // [`\b`], [ASCII Backspace (BS)], // [`\f`], [ASCII Formfeed (FF)], [`\n`], [ASCII Linefeed (LF)], // [`\r`], [ASCII Carriage Return (CR)], // [`\t`], [ASCII Horizontal Tab (TAB)], // [`\v`], [ASCII Vertical Tab (VT)], // [`\ooo`], [Octal character], // [`\xhh`], [Hexadecimal character], // [`\N{name}`], [Named Unicode character], // [`\uxxxx`], [Hexadecimal Unicode character], // [`\Uxxxxxxxx`], [Hexadecimal Unicode character], ) == 6. Expressions - `2+2` - `4` === 6.3. Primaries === 6.3.2 Subscriptions and slicings ==== 6.3.2.1. Slicings ``` word = 'Python' word[0] # character in position 0 word[-2] # second-last character word[0:2] # characters from position 0 (included) to 2 (excluded) word[:2] # character from the beginning to position 2 (excluded) word[4:] # characters from position 4 (included) to the end word[-2:] # characters from the second-last (included) to the end ``` === 6. 17. Operator precedence - Exponentiation: `**` - Multiplication, matrix multiplication, division, floor division, remainder: `*`, `@`, `/`, `//`, `%` - Addition and subtraction: `+`, `-` == 7. Simple statements === 7.2. Assignment statements ``` spam = 40 ``` === 7.9. The `break` statement === 7.10. The `continue` statement == 8. Compound statements === 8.1. The `if` statement === 8.2. The `while` statement === 8.3. The `for` statement = Built-ins == Built-in Types === Boolean Operations — `and`, `or`, `not` #table( columns: 2, table.header([Operation], [Result]), [`x or y`], [if `x` is true, then `x`, else `y`], [`x end y`], [if `x` is false, then `x`, else `y`], [`not x`], [if `x` is false, then `True`, else `False`], ) === Comparisons #table( columns: 2, table.header([Operation], [Meaning]), [`<`], [strictly less than], [`<=`], [less than or equal], [`>`], [strictly grater than], [`>=`], [grater than or equal], [`==`], [equal], [`!=`], [not equal], // [`is`], [object identity], // [`is not`], [negated object identity], ) === Numeric Types — `int`, `float`, `complex` === Boolean Type - `bool` + `True` + `False` === Sequence Types — `list`, `tuple`, `range` ==== Common Sequence Operations #table( columns: 2, table.header([Operation], [Result]), [`s + t`] , [concatenation of `s` and `t`], [`s * n` or `n * s`] , [equivalent to adding `s` to itself `n` times] ) === Text Sequence Type — `str` == Built-in Functions - `abs()` - `bin()` - `bool()` - `float()` - `hex()` - `input()` - `int()` - `len()` - `print()` - `range()` - `round()` - `str()` - `type()` = CLI