Python Learning Roadmap
This page takes you from your first Python statement to advanced programming concepts using practical real-world examples.
Beginner
Variables, data types, input, operators, conditions and loops.
Intermediate
Functions, lists, dictionaries, files, exceptions and modules.
Advanced
OOP, decorators, generators, APIs, databases and automation.
Real Projects
Billing systems, employee management, automation and data processing.
1. Your First Python Program
The first step is learning how to display information. Python uses the print() function.
print("Welcome to our company!")
print("Python training has started.")
Python training has started.
2. Variables and Data Types
Variables store information such as names, prices, quantities and customer details.
product_name = "Laptop"
price = 65000
quantity = 2
in_stock = True
print("Product:", product_name)
print("Price:", price)
print("Quantity:", quantity)
print("Available:", in_stock)
Price: 65000
Quantity: 2
Available: True
3. Taking User Input
The input() function allows a program to interact with users.
name = input("Enter customer name: ")
city = input("Enter city: ")
print("\nCustomer Details")
print("Name:", name)
print("City:", city)
4. Operators and Calculations
Python can perform mathematical calculations easily.
price = 1200
quantity = 3
subtotal = price * quantity
gst = subtotal * 0.18
total = subtotal + gst
print("Subtotal:", subtotal)
print("GST:", gst)
print("Total Bill:", total)
GST: 648.0
Total Bill: 4248.0
5. Conditions — if / elif / else
Conditions allow programs to make decisions.
performance = 85
if performance >= 90:
bonus = 20000
elif performance >= 75:
bonus = 10000
else:
bonus = 5000
print("Employee Bonus:", bonus)
6. Loops
Loops repeat a task multiple times. They are extremely useful for processing records.
orders = [1200, 850, 2300, 450, 1750]
for order in orders:
print("Processing order:", order)
7. Functions
Functions allow you to organize reusable logic.
def calculate_salary(basic, allowance):
return basic + allowance
salary = calculate_salary(40000, 10000)
print("Monthly Salary:", salary)
8. Lists
Lists store multiple values in a single variable.
products = [
"Laptop",
"Mouse",
"Keyboard",
"Monitor"
]
products.append("Printer")
for product in products:
print(product)
9. Dictionaries
Dictionaries store information using key-value pairs. They are useful for representing real-world records.
employee = {
"id": 101,
"name": "Rahul",
"department": "IT",
"salary": 55000
}
print("Employee:", employee["name"])
print("Department:", employee["department"])
print("Salary:", employee["salary"])
10. File Handling
Python can create, read and update files. This is useful for reports, logs and data storage.
sales = [
12000,
18000,
9500,
22000
]
total_sales = sum(sales)
with open("sales_report.txt", "w") as file:
file.write("Daily Sales Report\n")
file.write("------------------\n")
file.write(f"Total Sales: {total_sales}\n")
print("Sales report created.")
11. Exception Handling
Real applications need to handle unexpected situations without crashing.
try:
amount = float(input("Enter payment amount: "))
if amount <= 0:
raise ValueError("Amount must be greater than zero")
print("Payment accepted:", amount)
except ValueError as error:
print("Invalid payment:", error)
12. Object-Oriented Programming
Classes and objects are useful for modelling real-world entities such as customers, employees, products and accounts.
class BankAccount:
def __init__(self, owner, balance):
self.owner = owner
self.balance = balance
def deposit(self, amount):
self.balance += amount
def show_balance(self):
print("Account Holder:", self.owner)
print("Balance:", self.balance)
account = BankAccount("Amit", 25000)
account.deposit(5000)
account.show_balance()
Balance: 30000
Advanced Python Concepts
Once the fundamentals are comfortable, these concepts become important for larger applications.
List Comprehension
Create collections efficiently using concise expressions.
squares = [
x * x for x in range(1, 6)
]
Lambda
Create small anonymous functions.
double = lambda x: x * 2
print(double(10))
Generator
Generate values one at a time instead of storing everything in memory.
def numbers():
for i in range(5):
yield i
Decorator
Add reusable behavior to functions.
def logger(func):
def wrapper():
print("Running function")
return func()
return wrapper
13. Working with APIs
APIs allow Python programs to communicate with other applications and services.
import requests
url = "https://api.example.com/products"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
for product in data:
print(product)
else:
print("Unable to retrieve data")
14. Database Programming
Python can communicate with databases to store and retrieve application data.
import sqlite3
connection = sqlite3.connect("company.db")
cursor = connection.cursor()
cursor.execute("""
CREATE TABLE IF NOT EXISTS employees (
id INTEGER PRIMARY KEY,
name TEXT,
department TEXT
)
""")
cursor.execute("""
INSERT INTO employees
(name, department)
VALUES (?, ?)
""", ("Priya", "Finance"))
connection.commit()
print("Employee saved.")
connection.close()
15. Python Automation
Python can automate repetitive tasks such as creating folders, processing files and generating reports.
from pathlib import Path
months = [
"January",
"February",
"March",
"April"
]
base_folder = Path("Reports")
for month in months:
folder = base_folder / month
folder.mkdir(
parents=True,
exist_ok=True
)
print("Created:", folder)
Projects to Build After Learning Python
The fastest way to improve programming skills is to build complete projects.
| Project | Skills Practiced | Level |
|---|---|---|
| Calculator | Variables, input, operators | Beginner |
| Student Result System | Conditions, lists, functions | Beginner |
| Billing System | Lists, dictionaries, functions | Intermediate |
| Employee Management | OOP, files, databases | Intermediate |
| Expense Tracker | Files, dictionaries, functions | Intermediate |
| Weather Application | APIs, JSON, error handling | Advanced |
| Automation Tool | Pathlib, files, functions | Advanced |
| Database Application | SQL, SQLite, OOP | Advanced |
Recommended Learning Order
- Install Python and learn how to run a program.
- Learn print(), variables and data types.
- Learn input() and type conversion.
- Learn arithmetic and comparison operators.
- Learn if, elif and else.
- Learn for and while loops.
- Learn strings, lists, tuples and sets.
- Learn dictionaries.
- Learn functions.
- Learn modules and packages.
- Learn file handling.
- Learn exception handling.
- Learn Object-Oriented Programming.
- Learn APIs and JSON.
- Learn databases and SQL.
- Learn automation.
- Build complete projects.
What You Can Build with Python
Web Applications
Build web applications and backend services.
Data Analysis
Process, analyze and visualize business data.
AI & Machine Learning
Build applications involving machine learning and artificial intelligence.
Automation
Automate repetitive business and computer tasks.
APIs
Connect applications and external services.
Desktop Tools
Create utilities and productivity applications.