โ† 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

Ranked by how often each question comes up in real interviews. #1 is the most common.

#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๐Ÿ”’