Questions
Python questions
Choose a question page, learn the concept, then test your understanding with a quiz.
Selecting Multiple Columns in a Pandas DataFrame in Python
Learn how to select multiple columns in a Pandas DataFrame and create a new DataFrame using clear Python examples and common patterns.
Single vs Double Leading Underscores in Python
Learn what single and double leading underscores mean in Python names, including conventions, name mangling, and common mistakes.
Static Methods in Python: How to Define and Call Them
Learn how static methods work in Python, when to use @staticmethod, and how to call them on a class or instance with clear examples.
Understanding Python super() with __init__() Methods
Learn why Python super() is used, how it differs from Base.__init__(), and when to use each in inheritance.
What Are Metaclasses in Python? A Beginner-Friendly Guide
Learn what metaclasses are in Python, how they work, why they matter, and when to use them with simple examples.
What __all__ Means in Python: A Beginner-Friendly Guide
Learn what __all__ means in Python, how it affects imports, and why it often appears in __init__.py files and packages.
What __init__.py Is For in Python Packages
Learn what __init__.py does in Python, why it exists in packages, and how it is used for imports, setup, and module organization.
What `if __name__ == "__main__":` Does in Python
Learn what `if __name__ == "__main__":` means in Python, why it matters, and how it controls code when files are run or imported.
What the yield Keyword Does in Python
Learn what Python's yield keyword does, how generators work, and what happens when generator functions are called and iterated.
Why Membership Testing in Python range() Is So Fast
Learn why `x in range(...)` is fast in Python 3, how range membership works internally, and why it avoids generating all values.
Why Python Uses separator.join(iterable) Instead of list.join(separator)
Learn why Python uses separator.join(iterable), how str.join works, and the design reasoning behind this common Python string method.
__str__ vs __repr__ in Python: What’s the Difference?
Learn the difference between __str__ and __repr__ in Python, when each is used, and how to implement both with clear examples.
Page 6 of 6 - 112 questions