Comments and Documentation
Single-line, multi-line comments, docstrings
Interview Relevant: Code documentation
Comments
Use comments to explain code. Python ignores them.
Code Examples
Comments and Docstrings.
python
1# Single line comment
2
3"""
4Multi-line comment (technically a string).
5Can span multiple lines.
6"""
7
8def func():
9 """Function docstring: explains what the function does."""
10 pass