1/9
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Which character is used to start a single-line comment in Python?
#
What are "docstrings" and where are they typically placed?
Docstrings (documentation strings) are literal strings used to document modules, classes, or functions. They are placed immediately after the definition header (e.g., right under def my_function():).
Which syntax is used to create a multi-line docstring?
Triple quotes (""" or ''').
How does Python identify blocks of code (like the body of a loop or function)?
Indentation (whitespace).
What is the standard number of spaces recommended for indentation by PEP 8?
4 spaces.
What happens if you mix tabs and spaces for indentation in Python 3?
It raises a TabError.
In a function definition, what is the purpose of the def keyword?
It signals the start of a function header.
What is the purpose of the pass statement?
It acts as a null placeholder.
Why is "meaningful naming" (self-documenting code) important for code structure?
It makes the code readable without needing excessive comments.
How can you access the docstring of a function named calculate_area in the interactive shell?
help(calculate_area) or print(calculate_area.__doc__).