📎 Referral Code:
🎁 Referral Earnings ₹0
📊 Dashboard Sign In
🎁 ₹0
Your Referral Earnings → Tap to view
Navigation
book_slot
🗺️
Slot Booking
🗺️
Live Classes
📚
Courses
📝
Assignments
🧩
Practice Board
💡
Q & A
👤
My Profile
🏢
Recruiter Board
Job Support
🎯
Interview Board
🧑‍💼
Interview Support
Earn
🎁
Referral Program — ₹1,000 per referral
AI Tools
🌐
Project Explanation Agent
🛟
Support Works
← Back to Roadmap
🔓 Topic 4 · Free Preview
Python: Zero Coding. Zero IT Background. One Goal — Learn Python and Get Hired.
PythonPandasData CleaningReal Datasets
📖 Topic Content

No Coding, No Job — Python Basics Every Fresher Must Know

Today, companies want people who can code. If you don't know coding, you don't get the job. It is that simple. Python is the most wanted coding skill right now. This guide teaches it from absolute zero — no IT background needed, no complicated language. Just simple steps, real examples, and real code that companies use every single day. Start here. Learn at your own pace. Get job-ready.

🐍 Python Basics — Zero to Job Ready

Python Basics —
The Foundation of Every IT Career

You don't need a Computer Science degree. You don't need to be a maths expert. You just need to understand what each concept does — and where it is used in a real job. That is exactly what this guide gives you.

🔢 Data Types ⚖️ Operators ⚙️ Functions 🏗️ Classes 🔀 Conditions 🔁 Loops 📦 Modules ⚡ Multithreading
⚠️
Why You Cannot Skip Python Basics

Every day, companies are looking for people who can work with data. Not just people who know Excel. People who can automate, process large files, clean data, and build pipelines. Python and Pandas are the tools that make you that person. Not knowing them today is fine. Still not knowing them 6 months from now — while your batchmates learn them — is a risk you cannot afford. 

Every IT job — Python Developer, Data Engineer, ML Engineer, Cloud Engineer — starts with Python basics. If you don't understand data types, you will write bugs every day. If you don't understand loops, you cannot automate anything. If you don't understand functions, your code will be a mess nobody wants to maintain. These are not optional topics. They are the foundation. Without them, everything else falls apart.
1️⃣
Data Types
Numbers, Strings, List, Tuples, Sets, Dict, Boolean
2️⃣
Operators
Arithmetic, Comparison, Logical, Membership, Identity
3️⃣
Design Patterns
Functions and Classes
4️⃣
General Topics
Conditions, Loops, Modules, Multithreading
🤔
Part 1 — Why Programming? What Is Code?
Start Here
💭 Think About This First
Imagine your manager gives you an Excel file with 5 lakh (500,000) customer records. You need to open it, check every row, remove wrong entries, find duplicates, calculate totals, and create a report — by tomorrow morning. Would you do this manually?
Of course not. It would take weeks. Your eyes would hurt. You would make mistakes. And the next day — another 5 lakh records arrive. This is the exact problem that programming solves.
🏭
What is Programming? — Simple Analogy
Imagine a factory worker who packs 100 boxes per day by hand. A machine can pack 10,000 boxes per day — without breaks, without mistakes, every single day. Programming is writing instructions that tell a computer to do your work — automatically, accurately, and at any scale. You write the instructions once. The computer follows them a million times.
What is "code"? Code is simply a set of instructions written in a language the computer understands. Just like you give instructions in English to a person, you give instructions in Python to a computer. The difference is — a computer follows instructions perfectly, every time, without complaining.
😓 Without Programming
A company receives 50 Excel files every morning.

Someone opens each file manually.
Copies and pastes data.
Removes wrong rows by hand.
Calculates totals using formulas.
Creates a report after 6 hours.

Tomorrow — same 50 files again.
Same 6 hours. Same mistakes.
😊 With Python
The same 50 files arrive every morning.

Python reads all 50 files automatically.
Removes wrong rows — in seconds.
Calculates totals — instantly.
Creates and emails the report.
Total time: 2 minutes.

Tomorrow — same script runs again.
Zero human effort. Zero mistakes.
Why do companies use programming?
  • Speed — computers process millions of records in seconds
    A human takes 6 hours. Python takes 6 seconds. At 1 million records — Python wins every time.
  • 🎯
    Accuracy — no human errors, no "I forgot that row"
    Computers don't get tired. They don't miss rows. They apply the exact same rule to every single record.
  • 🔁
    Repetition — write once, run forever
    You write the code today. It runs every day automatically — without you sitting there doing it again.
  • 📈
    Scale — 100 rows or 100 million rows — same code
    Your Python script doesn't care if there are 100 records or 10 crore records. It handles both the same way.
🎯"Programming is not about being smart. It is about being lazy in a smart way — making computers do the boring, repetitive work so you don't have to."
🐍
Part 2 — Why Python? Why Not Any Other Language?
Your First Language
There are many programming languages — Java, C++, JavaScript, R, and more. So why should you, a non-IT person, learn Python specifically? Here is the honest answer:
🗣️
Why Python is the easiest to start with
Learning Python feels like learning English — simple, readable, close to how humans think. Learning Java or C++ feels like learning Latin — powerful but unnecessarily complicated for beginners. Python reads almost like plain English sentences. That is why beginners learn it 3x faster than any other language.
Java — complicated for beginners
public class Hello {
  public static void main(String[] args) {
    System.out.println("Hello");
  }
}
Python — simple as English
print("Hello")
Where do companies use Python?
  • 📊
    Data Engineering — processing millions of records daily
    Companies like Amazon, Swiggy, Zomato use Python to process crores of orders, payments, and customer records every day.
  • 🤖
    Machine Learning & AI — building smart systems
    Netflix's movie recommendations, Google's search results, spam filters in Gmail — all built with Python.
  • ☁️
    Cloud Automation — AWS Lambda, Glue, S3
    Python is the #1 language for AWS. Every cloud data pipeline you will build uses Python.
  • 📁
    File Automation — reading, writing, processing files
    CSV, Excel, JSON, PDF — Python can read, process, and generate all of them automatically.
  • 🌐
    API Integration — connecting to external systems
    Fetch weather data, stock prices, payment results — Python talks to any external system through APIs.
  • 🗄️
    Database Operations — reading and writing to databases
    Python connects to MySQL, PostgreSQL, Redshift, DynamoDB — insert, update, query, all from your script.
🏢
Real Company Scenario
You join an e-commerce company. Every morning, 50 CSV files arrive — one from each state office — each containing sales data. Your manager says: "Read all files, combine them, remove cancelled orders, calculate total revenue by state, and email the report to management by 9 AM." Without Python: 6 hours of manual work. With Python: 2 minutes. Automatically. Every morning.
💼 Jobs that use Python every single day
Data Engineer — ₹6-20 LPA Python Developer — ₹5-18 LPA Data Analyst — ₹4-15 LPA ML Engineer — ₹8-25 LPA Cloud Engineer — ₹6-20 LPA
📊
Part 3 — "I Already Know Excel. Why Should I Learn Python?"
Excel vs Python
This is the most common question. The honest answer is — Excel is great. But it has limits. And real companies hit those limits every day.
Situation ✅ Excel Can Handle 🐍 You Need Python
Number of rows Up to ~10,000 rows comfortably Millions of rows — no problem
Number of files 2-3 files manually 500 files automatically
Repeating daily You do it manually every day Script runs itself every day
Speed Slow on large data Processes millions in seconds
Database connection Limited / manual Direct, automated
API data Not possible easily Fetch any API data
AWS / Cloud Not possible Native — Lambda, Glue, S3
🔧
Think of it this way
Excel is like a hammer. Perfect for driving nails. But when you need to build a skyscraper — a hammer is not enough. Python is the construction crane. It does not replace the hammer for small jobs — but for large, complex, repeated work, nothing else comes close. In real companies, Python and Excel work side by side.
🎯"Excel = perfect for analysis and reports. Python = perfect for automation, large data, and cloud. Real companies use both. You should too."
 
🐍
Part 4 — Python Basics: Learning Sequence for Beginners
Stage 1
Now that you understand why you are learning Python, here is the exact sequence to learn it. Every topic is connected to a real use case — not just syntax.
📦 1. Variables — "Containers for Information"
A variable is simply a named box where you store a value. Just like a labelled box in a warehouse — the label (variable name) tells you what is inside (the value).
 
 
 
variables.pyPYTHON
# Real use: store customer information
customer_name  = "Priya Sharma"    # text value
order_amount   = 15000             # number
is_premium     = True              # yes/no (boolean)
city           = "Hyderabad"

print(f"Customer: {customer_name}")
print(f"Order Amount: ₹{order_amount}")
print(f"Premium Member: {is_premium}")
🔢 2. Data Types — "What Kind of Information?"
Python stores different types of information differently. Numbers for calculations. Text for names. Lists for multiple values. Dictionaries for structured records — just like a database row.
 
 
 
data_types.pyPYTHON
# String → text
name    = "Ravi Kumar"

# Integer → whole number
age     = 28

# Float → decimal number
salary  = 45000.50

# Boolean → True or False
is_active = True

# List → multiple values (like an Excel column)
cities  = ["Mumbai", "Delhi", "Hyderabad", "Bangalore"]

# Dictionary → one complete record (like one Excel row)
customer = {
    "id"    : 1001,
    "name"  : "Priya",
    "city"  : "Chennai",
    "amount": 8500
}
print(customer["name"])   # Priya
print(customer["amount"]) # 8500
🔀 3. Conditions — "Make Decisions in Code"
Conditions let your code make decisions. Just like you decide: "If the order amount is above ₹10,000 — apply a discount. Otherwise — don't." Python does the same thing automatically for every row.
 
 
 
conditions.pyPYTHON
# Real use: classify orders by value
order_amount = 15000

if order_amount > 10000:
    print("Premium Order — assign to VIP team")
elif order_amount > 5000:
    print("Standard Order")
else:
    print("Small Order")

# Real use: check order status
status = "Cancelled"
if status == "Cancelled":
    print("Alert: Order cancelled — investigate reason")
🔁 4. Loops — "Repeat Work Automatically"
A loop tells Python: "Do this same action for every item in this list." Instead of writing the same code 500 times — write it once inside a loop and let Python repeat it.
 
 
 
loops.pyPYTHON
# Real use: process 50 CSV files automatically
files = ["sales_jan.csv", "sales_feb.csv", "sales_mar.csv"]

for file in files:
    print(f"Processing: {file}")
    # read, clean, and save each file here

# Real use: calculate 10% GST for every order
order_amounts = [5000, 12000, 8500, 25000]

for amount in order_amounts:
    gst   = amount * 0.18
    total = amount + gst
    print(f"Order: ₹{amount} | GST: ₹{gst:.0f} | Total: ₹{total:.0f}")
⚙️ 5. Functions — "Reusable Instructions"
A function is a set of instructions you write once and reuse many times. Like a recipe — you write "how to make chai" once. Anyone can use the recipe anywhere, anytime. Functions make code clean, reusable, and professional.
 
 
 
functions.pyPYTHON
# Define the function once
def calculate_total(amount, gst_percent=18):
    """Calculate total amount including GST"""
    gst   = amount * (gst_percent / 100)
    total = amount + gst
    return total

# Use it anywhere — as many times as needed
print(calculate_total(5000))       # ₹5900.0
print(calculate_total(12000))      # ₹14160.0
print(calculate_total(8000, 5))   # ₹8400.0 (5% GST)

# Real use: clean a customer name
def clean_name(name: str) -> str:
    return name.strip().title()   # remove spaces, fix capitalization

print(clean_name("  priya sharma  "))  # "Priya Sharma"
✏️ Practice Task — Stage 1
Create a list of 5 customer names and their order amounts. Write a loop that goes through each customer. Inside the loop — if the amount is above ₹10,000, print "VIP Customer". Otherwise, print "Regular Customer". Try it yourself first. Then check the solution with your instructor.
🗺️
Part 5 — Python Basics: Complete Topic Map
What to Learn
Based on the Python Basics mindmap — here are all the topics, each explained with a simple why:
🔢 Data Types
Numbers — for calculations (salary, amount, age)
Strings — for text (name, city, email)
Lists — for multiple items (order IDs, cities)
Tuples — fixed lists (months of year)
Sets — unique values (unique cities)
Dictionary — one full record (customer row)
Boolean — True/False decisions
⚖️ Data Operators
Arithmetic — +, -, *, / (calculate totals, GST)
Comparison — >, <, == (filter orders)
Assignment — = (store values in variables)
Logical — and, or, not (combine conditions)
Membership — in, not in (check if city is in list)
Identity — is, is not (compare types)
🎨 Program Design Patterns
Functions — reusable blocks of code (process_order, clean_name)
Classes — blueprints for creating objects (CustomerRecord, OrderProcessor)
These make your code professional, organised, and reusable across projects.
📋 General Topics
Conditions — if/elif/else decisions
Loops — for, while (process every row)
Modules — ready-made tools (pandas, boto3, os)
Multithreading — process multiple files at once
Multiprocessing — use all CPU cores for heavy processing
💼 After learning all of these — you can apply for
Junior Python DeveloperData AnalystJunior Data EngineerAutomation Engineer
🔢
1 — Data Types
What Kind of Data?
1
Numbers — int and float
For any calculation — salary, price, quantity, age
🏦
Real Company Use
A bank stores your account balance as a float — 45230.75. An e-commerce company stores quantity as an int — 5 units. A payroll system calculates salary as int × float. Every number in every company database is either int or float.
 
 
 
data_types_numbers.pyPYTHON
# int — whole numbers (no decimal)
age          = 28
quantity     = 150
employee_id  = 1001

# float — decimal numbers
salary       = 45000.50
gst_rate     = 0.18
product_price= 899.99

# Real use: calculate total with GST
price       = 5000
gst         = price * 0.18
total       = price + gst
print(f"Price: ₹{price} | GST: ₹{gst:.0f} | Total: ₹{total:.0f}")
# Output: Price: ₹5000 | GST: ₹900 | Total: ₹5900

# type() — check what type a variable is
print(type(age))    # <class 'int'>
print(type(salary)) # <class 'float'>
✏️ Practice
Write a program that stores your name, age, and monthly salary. Calculate: yearly salary, income tax (30%), and salary after tax. Print all three results.
2
Strings — Text Data
Names, emails, cities, messages — any text is a String
📝
Real Company Use
Customer names, email addresses, city names, product descriptions, error messages, log entries — every piece of text in every application is a String. Data engineers clean strings daily — fixing capitalisation, removing spaces, splitting full names.
 
 
 
data_types_strings.pyPYTHON
# String basics
name   = "priya sharma"
email  = "priya@company.com"
city   = "  hyderabad  "   # extra spaces — common in real data

# String methods — used every day in data cleaning
print(name.upper())          # "PRIYA SHARMA"
print(name.title())          # "Priya Sharma"
print(city.strip())          # "hyderabad" (removes spaces)
print(email.split("@"))    # ['priya', 'company.com']
print(email.replace("com", "in")) # "priya@company.in"

# f-string — build messages with variables
customer = "Ravi"
amount   = 15000
print(f"Dear {customer}, your order of ₹{amount} is confirmed.")

# Real use: validate email format
is_valid_email = "@" in email and "." in email
print(f"Valid email: {is_valid_email}")  # True

# Split full name into first and last
full_name  = "Priya Sharma"
parts      = full_name.split(" ")
first_name = parts[0]   # "Priya"
last_name  = parts[1]   # "Sharma"
3
List — Multiple Values in Order
A collection of items — like a column in Excel
📋
Real Company Use
A list of cities your company operates in. All order IDs for today. All product names in a category. Whenever you have multiple values of the same kind — use a list. Data engineers loop through lists to process each item.
 
 
 
data_types_list.pyPYTHON
# List of cities
cities    = ["Mumbai", "Delhi", "Hyderabad", "Bangalore"]

# List of order amounts
amounts   = [5000, 12000, 3500, 8900, 25000]

# Access items by position (index starts at 0)
print(cities[0])    # "Mumbai"  (first)
print(cities[-1])   # "Bangalore" (last)

# Add, remove items
cities.append("Chennai")     # add to end
cities.remove("Delhi")       # remove specific item

# Real use: find total and average order amount
total   = sum(amounts)
average = sum(amounts) / len(amounts)
highest = max(amounts)
lowest  = min(amounts)
print(f"Total: ₹{total} | Avg: ₹{average:.0f} | Max: ₹{highest} | Min: ₹{lowest}")

# Real use: process multiple files
files = ["jan.csv", "feb.csv", "mar.csv"]
for file in files:
    print(f"Processing: {file}")
4
Tuple — Fixed List That Cannot Change
Values that should never be modified — use tuple not list
 
 
 
data_types_tuple.pyPYTHON
# Tuple — values cannot be changed after creation
months     = ("Jan", "Feb", "Mar", "Apr", "May", "Jun",
               "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")

db_config  = ("localhost", 5432, "mydb")  # host, port, dbname
aws_region = ("us-east-1",)   # single item tuple needs comma

# Access same as list
print(months[0])   # "Jan"
print(months[-1])  # "Dec"

# Unpacking — assign tuple values to variables
host, port, db = db_config
print(f"Connecting to {host}:{port}/{db}")

# Real use: return multiple values from a function
def get_stats(numbers):
    return min(numbers), max(numbers), sum(numbers) / len(numbers)

low, high, avg = get_stats([5000, 12000, 8000])
print(f"Min: ₹{low} | Max: ₹{high} | Avg: ₹{avg:.0f}")
🎯"Use tuple when the values must never change — months, DB config, status codes. Use list when values will be added, removed, or updated."
5
Set — Unique Values Only
Automatically removes duplicates — perfect for deduplication
 
 
 
data_types_set.pyPYTHON
# Set — only keeps unique values
raw_cities  = ["Mumbai", "Delhi", "Mumbai", "Bangalore", "Delhi"]
unique_cities = set(raw_cities)
print(unique_cities)  # {'Mumbai', 'Delhi', 'Bangalore'}

# Real use: check if a city is in approved list
approved_cities = {"Mumbai", "Delhi", "Bangalore", "Hyderabad"}
customer_city   = "Chennai"

if customer_city in approved_cities:
    print("Delivery available")
else:
    print("Delivery not available in this city")

# Set operations — useful in data analysis
set_a = {"Ravi", "Priya", "John"}
set_b = {"Priya", "Anu", "John"}

print(set_a & set_b)  # Common: {'Priya', 'John'}
print(set_a | set_b)  # All unique: {'Ravi', 'Priya', 'John', 'Anu'}
print(set_a - set_b)  # Only in A: {'Ravi'}
6
Dictionary — One Complete Record
Key-value pairs — like one row in a database table
🗂️
Real Company Use
One customer record in a database = one dictionary in Python. API responses come as dictionaries. Configuration files are dictionaries. Dictionary is the most used data type in real Python projects.
 
 
 
data_types_dict.pyPYTHON
# Dictionary — key:value pairs
customer = {
    "id"     : 1001,
    "name"   : "Priya Sharma",
    "city"   : "Hyderabad",
    "amount" : 15000,
    "status" : "Delivered"
}

# Access values by key
print(customer["name"])    # "Priya Sharma"
print(customer["amount"])  # 15000

# Safe access — no error if key missing
print(customer.get("phone", "Not provided"))  # "Not provided"

# Add or update a key
customer["gst"] = customer["amount"] * 0.18

# Loop through all keys and values
for key, value in customer.items():
    print(f"{key}: {value}")

# Real use: process API response
api_response = {
    "status"  : "success",
    "data"    : {"order_id": "ORD001", "total": 5900},
    "message" : "Order placed successfully"
}
order_id = api_response["data"]["order_id"]
print(f"Order confirmed: {order_id}")
7
Boolean — True or False Only
Every decision in code is ultimately True or False
 
 
 
data_types_boolean.pyPYTHON
# Boolean — only two values: True or False
is_active   = True
is_deleted  = False
is_premium  = True

# Real use: feature flags in applications
ENABLE_EMAIL  = True
ENABLE_SMS    = False
MAINTENANCE_MODE = False

if ENABLE_EMAIL:
    print("Sending email notification...")
if not MAINTENANCE_MODE:
    print("System is running normally")

# Comparison results are boolean
amount = 15000
print(amount > 10000)   # True
print(amount == 5000)  # False

# Real use: validate before processing
order_amount = 12000
is_valid     = order_amount > 0 and order_amount < 100000
print(f"Order valid: {is_valid}")  # True
💼 Data Types in every IT job
str → clean customer namesint/float → calculate revenuelist → process multiple recordsdict → store one complete recordbool → control program flow
⚖️
2 — Data Operators
Do Things with Data
Operators are the symbols that do something with your data. Without operators, you cannot calculate, compare, or make decisions. Every single line of real Python code uses at least one operator.
 
 
 
operators_complete.pyPYTHON
# ── 1. Arithmetic Operators — Calculate ───────────────────────────
price    = 10000
quantity = 5
discount = 0.10

subtotal = price * quantity            # 50000  → multiplication
discount_amount = subtotal * discount  # 5000   → multiply
total    = subtotal - discount_amount  # 45000  → subtract
gst      = total * 0.18               # 8100   → multiply
grand    = total + gst                # 53100  → add
per_item = grand / quantity           # 10620  → divide
remainder= 53100 % 1000               # 100    → modulus (remainder)
squared  = 5 ** 2                     # 25     → power

print(f"Grand Total: ₹{grand} | Per Item: ₹{per_item:.0f}")

# ── 2. Comparison Operators — Compare values ──────────────────────
amount = 15000
print(amount > 10000)   # True  → greater than
print(amount < 5000)    # False → less than
print(amount >= 15000)  # True  → greater than or equal
print(amount == 15000)  # True  → equal to
print(amount != 10000)  # True  → not equal to

# ── 3. Assignment Operators — Store and update values ─────────────
score  = 100       # =   → assign
score += 50       # +=  → add and assign (score = score + 50 = 150)
score -= 20       # -=  → subtract and assign (150 - 20 = 130)
score *= 2        # *=  → multiply and assign (130 * 2 = 260)

# ── 4. Logical Operators — Combine conditions ─────────────────────
city   = "Mumbai"
amount = 15000

# and — BOTH must be True
if city == "Mumbai" and amount > 10000:
    print("Mumbai VIP customer")

# or — AT LEAST ONE must be True
if city == "Mumbai" or city == "Delhi":
    print("Metro city delivery — same day")

# not — reverse the result
is_cancelled = False
if not is_cancelled:
    print("Order is active")

# ── 5. Membership Operators — Check if item exists ────────────────
valid_statuses = ["Delivered", "Shipped", "Processing"]
order_status   = "Delivered"

if order_status in valid_statuses:
    print("Valid status")
if "Cancelled" not in valid_statuses:
    print("Cancelled is not a valid active status")

# ── 6. Identity Operators — Check if same object ──────────────────
x = None
if x is None:
    print("No value assigned yet")
if x is not None:
    print("Has a value")
💼
Interview Question
"What is the difference between == and is?"
== checks if two values are equal. is checks if two variables point to the exact same object in memory. Always use == None to compare values. Use is None to check if a variable has no value assigned.
🏗️
3 — Program Design Patterns
Functions & Classes
F
Functions — Write Once, Use Everywhere
def function_name(): — the most important keyword in professional Python
🍳
Real Company Use
A function is like a recipe. You write the recipe once. Anyone can use it anytime, anywhere in the project. If the recipe needs to change — you change it in one place, and everyone gets the updated version. Senior engineers look for functions everywhere — if you copy-paste code instead of using functions, it is a red flag in code review.
 
 
 
functions.pyPYTHON
# ── Basic Function ────────────────────────────────────────────────
def calculate_total(price: float, gst_rate: float = 0.18) -> float:
    """Calculate final price including GST.
    
    Args:
        price    : base price before tax
        gst_rate : GST percentage (default 18%)
    Returns:
        float: total price including GST
    """
    gst   = price * gst_rate
    total = price + gst
    return total

# Use it anywhere
print(calculate_total(5000))       # ₹5900.0  (18% GST)
print(calculate_total(10000, 0.05)) # ₹10500.0 (5% GST)

# ── Function returning multiple values ────────────────────────────
def validate_order(customer_id: str, amount: float) -> tuple:
    """Validate order and return status and message"""
    if not customer_id:
        return False, "Customer ID is required"
    if amount <= 0:
        return False, "Amount must be greater than zero"
    if amount > 500000:
        return False, "Amount exceeds limit"
    return True, "Order is valid"

is_valid, message = validate_order("C001", 15000)
print(f"Valid: {is_valid} | {message}")

# ── Function with list processing ────────────────────────────────
def process_orders(orders: list) -> dict:
    """Process a list of orders and return summary"""
    total     = sum(order["amount"] for order in orders)
    delivered = [o for o in orders if o["status"] == "Delivered"]
    return {
        "total_revenue"   : total,
        "total_orders"    : len(orders),
        "delivered_count" : len(delivered)
    }

orders = [
    {"id": "O1", "amount": 5000, "status": "Delivered"},
    {"id": "O2", "amount": 12000,"status": "Cancelled"},
    {"id": "O3", "amount": 8000, "status": "Delivered"},
]
summary = process_orders(orders)
print(summary)
✏️ Practice
Write a function called classify_customer that takes a total_spent amount and returns "Gold" if above ₹1,00,000 — "Silver" if above ₹50,000 — "Bronze" otherwise. Test it with 5 different amounts.
C
Classes — Blueprint for Creating Objects
class ClassName: — groups related data and functions together
🏭
Real Company Use
A class is like a blueprint for a house. The blueprint defines what every house has — rooms, doors, windows. Each actual house built from that blueprint is an object. Similarly — a Customer class defines what every customer has (id, name, city). Each actual customer is an object created from that class.
 
 
 
classes.pyPYTHON
# ── Define the Class (Blueprint) ──────────────────────────────────
class Customer:
    """Represents one customer in the system"""

    def __init__(self, customer_id, name, city):
        self.customer_id = customer_id
        self.name        = name
        self.city        = city
        self.orders      = []          # empty list — no orders yet
        self.total_spent = 0

    def add_order(self, order_id, amount):
        """Add a new order for this customer"""
        self.orders.append({"id": order_id, "amount": amount})
        self.total_spent += amount

    def get_tier(self) -> str:
        """Return customer tier based on total spending"""
        if self.total_spent >= 100000: return "Gold"
        if self.total_spent >= 50000:  return "Silver"
        return "Bronze"

    def get_summary(self) -> str:
        return (f"[{self.customer_id}] {self.name} | {self.city} | "
                f"Orders: {len(self.orders)} | Spent: ₹{self.total_spent:,} | {self.get_tier()}")


# ── Create Objects (Instances) from the Class ─────────────────────
c1 = Customer("C001", "Priya Sharma", "Hyderabad")
c2 = Customer("C002", "Ravi Kumar",  "Mumbai")

# Add orders to each customer
c1.add_order("O101", 15000)
c1.add_order("O102", 45000)
c1.add_order("O103", 60000)

c2.add_order("O201", 8000)
c2.add_order("O202", 32000)

# Print summaries
print(c1.get_summary())
# [C001] Priya Sharma | Hyderabad | Orders: 3 | Spent: ₹1,20,000 | Gold
print(c2.get_summary())
# [C002] Ravi Kumar | Mumbai | Orders: 2 | Spent: ₹40,000 | Bronze
🎯"Class = blueprint. Object = the actual thing built from the blueprint. Every real Python project uses classes to organise data and logic together."
📋
4 — General Topics
Conditions, Loops, Modules & More
🔀
Conditions — Make Decisions in Code
if / elif / else — every program makes decisions
 
 
 
conditions.pyPYTHON
# Basic if / elif / else
amount = 15000

if amount > 100000:
    print("Gold customer — assign relationship manager")
elif amount > 50000:
    print("Silver customer — priority support")
elif amount > 10000:
    print("Standard customer")
else:
    print("New customer — send welcome offer")

# Real use: process only valid orders
status = "Delivered"
amount = 5000

if status == "Delivered" and amount > 0:
    print("Process payment to seller")
elif status == "Cancelled":
    print("Process refund to customer")
else:
    print("Order still in progress — skip")

# One-line condition (ternary operator)
order_type = "VIP" if amount > 10000 else "Regular"
print(f"Order type: {order_type}")
🔁
Loops — Repeat Automatically
for loop and while loop — the engine of automation
 
 
 
loops.pyPYTHON
# For loop — for each item in a list
cities = ["Mumbai", "Delhi", "Hyderabad"]
for city in cities:
    print(f"Processing orders for: {city}")

# For loop with range — repeat N times
for i in range(1, 6):      # 1 to 5
    print(f"Retry attempt {i}")

# Loop through list of orders with index
orders = [5000, 12000, 3500, 8900]
for index, amount in enumerate(orders, 1):
    print(f"Order {index}: ₹{amount}")

# While loop — keep running until condition is False
retry_count = 0
success     = False

while retry_count < 3 and not success:
    print(f"Attempt {retry_count + 1}: Connecting to database...")
    retry_count += 1
    # in real code: try the connection here
    success = True  # connection succeeded

# List comprehension — build a new list using a loop in one line
amounts     = [5000, 12000, 3500, 8900, 15000]
with_gst   = [a * 1.18 for a in amounts]
high_value = [a for a in amounts if a > 8000]
print(f"High value orders: {high_value}")  # [12000, 8900, 15000]
✏️ Practice
Create a list of 10 numbers. Write a loop that goes through each number — if it is greater than 5000, add it to a "high" list. Otherwise add it to a "low" list. Print the total of each list. Try using both a for loop and a list comprehension.
📦
Predefined Modules — Ready-Made Tools
import — use Python's built-in tools instead of writing from scratch
 
 
 
modules.pyPYTHON
# os — work with files and folders
import os
files = os.listdir(".")          # list all files in current folder
exists= os.path.exists("data.csv") # check if file exists

# datetime — work with dates and times
from datetime import datetime, timedelta
today    = datetime.now()
yesterday= today - timedelta(days=1)
formatted= today.strftime("%Y-%m-%d")   # "2024-07-23"
print(f"Today: {formatted}")

# json — read/write JSON data (APIs use JSON)
import json
data       = {"order_id": "O001", "amount": 5000}
json_str   = json.dumps(data)        # dict → JSON string
back_to_dict= json.loads(json_str)  # JSON string → dict

# csv — read and write CSV files
import csv
with open("orders.csv", "r") as f:
    reader = csv.DictReader(f)
    for row in reader:
        print(row)   # each row is a dictionary

# random — generate random data (for testing)
import random
test_amount = random.randint(1000, 50000)  # random number between 1000 and 50000

# math — mathematical operations
import math
print(math.ceil(4.2))   # 5  → round up
print(math.floor(4.9))  # 4  → round down
print(math.sqrt(16))   # 4.0 → square root
Multithreading & Multiprocessing
Do multiple things at the same time — speed up heavy work
👷
Simple Analogy
Multithreading = one worker doing many tasks quickly by switching between them (reading email while downloading a file). Multiprocessing = many workers each doing one task independently at the same time (4 people each packing 250 boxes instead of 1 person packing 1000). Both make your program faster.
 
 
 
threading_multiprocessing.pyPYTHON
# ── Multithreading — good for I/O tasks (file read, API calls) ────
import threading
import time

def download_file(filename):
    print(f"Downloading {filename}...")
    time.sleep(2)   # simulate download time
    print(f"✅ {filename} downloaded")

# Without threading: downloads one by one — 6 seconds total
# With threading: all 3 download at same time — 2 seconds total

files   = ["report1.csv", "report2.csv", "report3.csv"]
threads = []

for file in files:
    t = threading.Thread(target=download_file, args=(file,))
    threads.append(t)
    t.start()

for t in threads:
    t.join()   # wait for all threads to finish

print("All files downloaded!")


# ── Multiprocessing — good for CPU-heavy tasks ────────────────────
from multiprocessing import Pool

def process_city_data(city):
    print(f"Processing {city} orders...")
    # heavy calculation — runs on separate CPU core
    return f"{city}: done"

cities = ["Mumbai", "Delhi", "Hyderabad", "Bangalore"]

# Process all cities in parallel using 4 CPU cores
with Pool(processes=4) as pool:
    results = pool.map(process_city_data, cities)
print(results)
💼
Interview Question
"When would you use multithreading vs multiprocessing?"
Use threading for I/O-bound tasks — reading files, calling APIs, downloading data (waiting for external responses). Use multiprocessing for CPU-bound tasks — heavy calculations, image processing, data transformations (using all CPU cores).
📋
Quick Reference — All Python Basics
Cheat Sheet
Topic Key Concept Real Use Case Key Syntax
int / float Numbers Salary, price, quantity age = 28
str Text Names, emails, cities "Priya".upper()
list Ordered collection List of orders, cities [1, 2, 3]
tuple Fixed collection DB config, months (1, 2, 3)
set Unique values Deduplicate data {1, 2, 3}
dict Key-value pairs One record / API response {"key": "val"}
bool True / False Flags, decisions is_active = True
Arithmetic Calculate GST, salary, totals + - * / % **
Comparison Compare Filter large orders > < == != >= <=
Logical Combine conditions Multiple filters and or not
Membership Check existence City in approved list in not in
def Function Reusable calculation def my_func():
class Blueprint Customer, Order objects class Customer:
if/elif/else Decision Classify customers if x > 0:
for / while Repeat Process all records for x in list:
import Use modules Date, JSON, files, math import datetime
threading Parallel I/O Download multiple files Thread(target=fn)
multiprocessing Parallel CPU Process multiple cities Pool(processes=4)
💼 After mastering all these — you can apply for
Junior Python Developer — ₹4-8 LPAJunior Data Engineer — ₹5-10 LPAData Analyst — ₹4-8 LPAAutomation Engineer — ₹5-10 LPACloud Engineer (Python) — ₹6-12 LPA
🐍
You Now Know the Foundation of Every IT Career
Data Types. Operators. Functions. Classes. Conditions. Loops. Modules. Multithreading. These are not just Python topics — they are the building blocks of everything you will ever build in your career. Master these once. Use them everywhere. Forever.
"Every expert was once a beginner who refused to give up. You have already started. Keep going."
Like what you're seeing?
This is 1 of 30 topics. Join Personal Training to unlock the rest — plus assignments, interview Q&A, and 1-on-1 progress tracking.
🎯 See Full Roadmap & Join →