Module: M3-R5: Python Programming
Chapter: Ch1 Computer Intro
Documentation is the written explanation or guide that describes what your program does, how it works, and how to use it. It helps others (and even you in the future) understand the code quickly without needing to go through each line.
In Python, documentation can include comments, docstrings, README files, and API documentation. Good documentation saves time, improves collaboration, and makes the code maintainable.
# This program adds two numbers
num1 = 10 # first number
num2 = 20 # second number
sum = num1 + num2 # calculating the sum
print("Sum =", sum)
Inline comments (starting with #) explain each step in the program. These help anyone reading the code to quickly understand what’s happening.
def greet(name):
"""This function greets the person passed as a parameter."""
print("Hello, " + name + "!")
greet("Sourav")
Docstrings are written using triple quotes (""" ... """) and are used to describe the function, class, or module.
You can access them using Python’s built-in help() function.
help(greet)
Output:
Help on function greet in module __main__:
greet(name)
This function greets the person passed as a parameter.
# Student Management System
A simple Python project to manage student records.
## Features
- Add, update, and delete student records
- Search by name or ID
- Display all student data
## Requirements
- Python 3.x
- SQLite3
## Run
python main.py
This type of documentation is usually stored in a file named README.md in your project folder. It helps new users understand what the project is and how to use it.