← All topics

🐍 Interview Prep

Python

Mutability, comprehensions, generators, decorators, classes and the standard library: what Python-heavy teams test.

πŸ“˜ Learn it from scratch

Visual, hands-on lessons for every pattern in this topic. Do the lesson, then come back and the questions click.

100 questions, most asked first

Ordered so the most useful questions for learning each pattern come first.

#2List vs tupleData types & mutabilityEasyFree#3is vs ==Data types & mutabilityEasyFree#5List comprehensionsPythonic codeEasyFree#8*args and **kwargsFunctionsEasyFreeUnlock 41 more Python questions Β· all 1,200 questions for $39/year (about 11Β’ a day)See full access#12Count word frequencyStandard libraryEasyπŸ”’#13try / except / else / finallyErrorsEasyπŸ”’#19lambda, map, filter and sorted with keyFunctionsEasyπŸ”’#20SlicingPythonic codeEasyπŸ”’#21enumerate and zipPythonic codeEasyπŸ”’#22dict.get, setdefault and defaultdictStandard libraryEasyπŸ”’#29f-strings and string formattingPythonic codeEasyπŸ”’#31Truthiness in PythonData types & mutabilityEasyπŸ”’#32Checking for NoneData types & mutabilityEasyπŸ”’#33The walrus operator (:=)Pythonic codeEasyπŸ”’#34Unpacking and star expressionsPythonic codeEasyπŸ”’#35Invert a dictionary (dict comprehension)Pythonic codeEasyπŸ”’#36Set operationsData types & mutabilityEasyπŸ”’#38Memoization with functools.lru_cacheDecorators & context managersEasyπŸ”’#42Duck typing and EAFPOOP & dunder methodsEasyπŸ”’#43Type hints in PythonFunctionsEasyπŸ”’#44Virtual environments and dependenciesStandard libraryEasyπŸ”’#45if __name__ == "__main__"Standard libraryEasyπŸ”’#46Working with JSONStandard libraryEasyπŸ”’#54append vs extend vs +Data types & mutabilityEasyπŸ”’#55list.sort() vs sorted()Pythonic codeEasyπŸ”’#56Chained comparisonsPythonic codeEasyπŸ”’#57any() and all()Pythonic codeEasyπŸ”’#60logging vs printStandard libraryEasyπŸ”’#61Testing with pytestFunctionsEasyπŸ”’#64What does range() actually return?Iterators & generatorsEasyπŸ”’#70__str__ vs __repr__OOP & dunder methodsEasyπŸ”’#71functools.partialFunctionsEasyπŸ”’#72functools.reduceFunctionsEasyπŸ”’#73map/filter vs comprehensionsPythonic codeEasyπŸ”’#74zip vs zip_longestStandard libraryEasyπŸ”’#77Python integers never overflowData types & mutabilityEasyπŸ”’#83EnumsStandard libraryEasyπŸ”’#85Flask vs Django vs FastAPIStandard libraryEasyπŸ”’#87PEP 8 and clean PythonPythonic codeEasyπŸ”’#91break, continue and passPythonic codeEasyπŸ”’#92String cleanup β€” make a URL slugPythonic codeEasyπŸ”’#93Are dictionaries ordered?Data types & mutabilityEasyπŸ”’#94Transpose a matrix with zipPythonic codeEasyπŸ”’#97Reading a file line by lineDecorators & context managersEasyπŸ”’#100Closures in PythonFunctionsEasyπŸ”’