Index Symbols | _ | A | B | C | D | E | F | G | H | I | K | L | M | N | O | P | Q | R | S | T | V | W | Y | Z Symbols = vs == @classmethod @dataclass basic defaults frozen methods _ __init__ __lt__ __mul__ __repr__, [1], [2] __str__ __sub__ __truediv__ _name convention A absolute path, [1] accumulation pattern and and operator argument arithmetic ASCII assert assignment no declaration needed assignment statement right-to-left augmented assignment Averager class, [1] B balanced brackets stack base case binary search, [1] recursive, [1] bisect module bisection method bool, [1] Boolean Boolean operators break in for loop bubble sort built-in functions abs built-in types C call stack recursion character codes chr() class Contact examples instantiation keyword method with same-type parameter planning Rational collections.Counter collections.deque, [1] comments comparison operators compound condition Console ReadLine equivalent continue in for loop continue statement Counter, [1] current working directory D dataclass def statement del dict denial of service recursion dequeue dict access constructor efficiency examples grouping invert key must be immutable, [1] key-value literal syntax update word count dict.items() dict.keys() dict.pop() dict.values() dictionary directory traversal divmod dunder methods E edge cases elif elif vs separate if enqueue enumerate() escape sequence escape sequences table Euclidean algorithm example copy upper for loop mod table power table sum file F f-string basic syntax field width file output f.read() f.readlines() f.write() factorial iterative recursive False Fibonacci iterative recursive file path read into dict reading reading into dict writing file system flatten recursive float float() for dict file lines list iteration tuple unpacking for line in f: for loop examples for statement for vs while foreach format specifier format string from … import function def early return keyword arguments multiple definitions multiple parameters parameter return value functools.lru_cache G GCD recursive, [1] gcd generator factorial, [1] Fibonacci, [1] infinite sequence global statement H hash immutability hash function hash table, [1] I identifier if common mistakes nested one-branch if __name__ if __name__ == '__main__' if statement if-elif-else import where Python looks import statement in dict key list membership search in operator indentation pitfall infinite loop input validation input function insertion sort instance method instance variable access planning int() integer interactive while loop introduction is not operator is operator itertools.takewhile K key= L labs dictionaries lists nested loops string operations len(), [1] linear search, [1] explicit linked list construction performance traversal list * + accumulate built-in functions constructor filter index indexing len() literal methods min mutable of class instances of tuples rotate slicing, [1] sort syntax two-pointer list comprehension basic form nested with condition list.append() list.count() list.extend() list.index() list.insert() list.pop() list.remove() list.reverse() list.sort(), [1] local scope local variable loop for interactive range while M math module max max() memoisation method planning min() mixed arithmetic modular arithmetic module multiline string multiple assignment, [1] multiples example multiplication table N naming conventions negative index nested if nested list nested loop table Node class, [1] None implicit return testing not not in operator not operator numerical methods NUnit comparison O O(1) lookup O(1) vs O(N) off-by-one in conditions OOP __init__ class relationships design nouns as classes private open() "a" "w" append mode write mode operator %= *= += -= //= arithmetic operator overloading operator precedence or or operator ord() os.walk recursive P parallel lists parameter Path open() Path object path separator path string Path() constructor Path.cwd() Path.exists(), [1] Path.glob() Path.home() Path.is_dir() Path.is_file() Path.iterdir() Path.name Path.parent Path.read_text() Path.stem Path.suffix Path.write_text() pathlib pathlib.Path / operator pitfalls pop print print_rectangle print_reps problem solving program structure push pytest install running test discovery pytest.raises, [1] Python if syntax interactive shell, [1] Q queue FIFO Queue class quotes R random module range reverse with for loop range() range(n) range(start, [1] Rational __add__ __eq__ __init__ __str__ classmethod float() testing raw string recursion examples security structure recursion limit RecursionError recursive case relational operators relative path, [1] REPL, [1] return statement reverse= reversed(), [1] review questions classes data structures dictionaries files for loops lists recursion testing tuples while loops round S scope why local scope matters searching selection sort self, [1] short-circuit evaluation singly linked list SinglyLinkedList slice slice notation snake_case sorted(), [1], [2] key with tuple sorting performance stack LIFO Stack class stack exhaustion step) stop stop) str() str.endswith() str.find() str.format() str.index() str.join() str.lower() str.lstrip() str.replace() str.rstrip() str.split() str.startswith() str.strip() str.upper() string immutability, [1] in operator indexing method method summary negative index problem solving reverse slice slicing step in slice subscript while loop string concatenation string literal string repetition string representation string_of_reps sum() swap variables swap variables syntax template sys.setrecursionlimit T table formatting tail-call optimisation TCO test class test function, [1] testing edge cases effective one assert per test pytest triple-quoted string True truthiness truthiness pitfall try/except, [1] tuple as dict key constructor dict key examples immutability immutable index len() literal multiple return values record syntax tuple unpacking *rest basic tuple() list() type conversion, [1], [2], [3] type conversion functions types V variable assignment W while sequence iteration while statement while True interactive pattern whitespace with open() reading with statement word count word count example Y yield Z zip(), [1] paired iteration