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.
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.
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.
| 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 |
# Real use: store customer information customer_name ="Priya Sharma" # text value order_amount =15000 # number is_premium =True # yes/no (boolean) city ="Hyderabad" f"Customer: {customer_name}" )f"Order Amount: ₹{order_amount}" )f"Premium Member: {is_premium}" )
# 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 }customer ["name" ])# Priya customer ["amount" ])# 8500
# Real use: classify orders by value order_amount =15000 if order_amount >10000 :"Premium Order — assign to VIP team" )elif order_amount >5000 :"Standard Order" )else :"Small Order" )# Real use: check order status status ="Cancelled" if status =="Cancelled" :"Alert: Order cancelled — investigate reason" )
# Real use: process 50 CSV files automatically files = ["sales_jan.csv" ,"sales_feb.csv" ,"sales_mar.csv" ]for file in files :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 f"Order: ₹{amount} | GST: ₹{gst:.0f} | Total: ₹{total:.0f}" )
# 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 calculate_total (5000 ))# ₹5900.0 calculate_total (12000 ))# ₹14160.0 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 clean_name (" priya sharma " ))# "Priya Sharma"
# 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 f"Price: ₹{price} | GST: ₹{gst:.0f} | Total: ₹{total:.0f}" )# Output: Price: ₹5000 | GST: ₹900 | Total: ₹5900 # type() — check what type a variable is type (age ))# <class 'int'> type (salary ))# <class 'float'>
# String basics name ="priya sharma" "priya@company.com" city =" hyderabad " # extra spaces — common in real data # String methods — used every day in data cleaning name .upper ())# "PRIYA SHARMA" name .title ())# "Priya Sharma" city .strip ())# "hyderabad" (removes spaces) split ("@" ))# ['priya', 'company.com'] replace ("com" ,"in" ))# "priya@company.in" # f-string — build messages with variables customer ="Ravi" amount =15000 f"Dear {customer}, your order of ₹{amount} is confirmed." )# Real use: validate email format is_valid_email ="@" in and "." in 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"
# 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) cities [0 ])# "Mumbai" (first) 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 )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 :f"Processing: {file}" )
# 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 months [0 ])# "Jan" months [-1 ])# "Dec" # Unpacking — assign tuple values to variables host ,port ,db =db_config 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 ])f"Min: ₹{low} | Max: ₹{high} | Avg: ₹{avg:.0f}" )
# Set — only keeps unique values raw_cities = ["Mumbai" ,"Delhi" ,"Mumbai" ,"Bangalore" ,"Delhi" ]unique_cities =set (raw_cities )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 :"Delivery available" )else :"Delivery not available in this city" )# Set operations — useful in data analysis set_a = {"Ravi" ,"Priya" ,"John" }set_b = {"Priya" ,"Anu" ,"John" }set_a &set_b )# Common: {'Priya', 'John'} set_a |set_b )# All unique: {'Ravi', 'Priya', 'John', 'Anu'} set_a -set_b )# Only in A: {'Ravi'}
# Dictionary — key:value pairs customer = {"id" :1001 ,"name" :"Priya Sharma" ,"city" :"Hyderabad" ,"amount" :15000 ,"status" :"Delivered" }# Access values by key customer ["name" ])# "Priya Sharma" customer ["amount" ])# 15000 # Safe access — no error if key missing 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 ():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" ]f"Order confirmed: {order_id}" )
# 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 :"Sending email notification..." )if not MAINTENANCE_MODE :"System is running normally" )# Comparison results are boolean amount =15000 amount >10000 )# True amount ==5000 )# False # Real use: validate before processing order_amount =12000 is_valid =order_amount >0 and order_amount <100000 f"Order valid: {is_valid}" )# True
# ── 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 f"Grand Total: ₹{grand} | Per Item: ₹{per_item:.0f}" )# ── 2. Comparison Operators — Compare values ────────────────────── amount =15000 amount >10000 )# True → greater than amount <5000 )# False → less than amount >=15000 )# True → greater than or equal amount ==15000 )# True → equal to 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 :"Mumbai VIP customer" )# or — AT LEAST ONE must be True if city =="Mumbai" or city =="Delhi" :"Metro city delivery — same day" )# not — reverse the result is_cancelled =False if not is_cancelled :"Order is active" )# ── 5. Membership Operators — Check if item exists ──────────────── valid_statuses = ["Delivered" ,"Shipped" ,"Processing" ]order_status ="Delivered" if order_status in valid_statuses :"Valid status" )if "Cancelled" not in valid_statuses :"Cancelled is not a valid active status" )# ── 6. Identity Operators — Check if same object ────────────────── x =None if x is None :"No value assigned yet" )if x is not None :"Has a value" )
== 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.# ── 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 calculate_total (5000 ))# ₹5900.0 (18% GST) 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 )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 )summary )
# ── 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 c1 .get_summary ())# [C001] Priya Sharma | Hyderabad | Orders: 3 | Spent: ₹1,20,000 | Gold c2 .get_summary ())# [C002] Ravi Kumar | Mumbai | Orders: 2 | Spent: ₹40,000 | Bronze
# Basic if / elif / else amount =15000 if amount >100000 :"Gold customer — assign relationship manager" )elif amount >50000 :"Silver customer — priority support" )elif amount >10000 :"Standard customer" )else :"New customer — send welcome offer" )# Real use: process only valid orders status ="Delivered" amount =5000 if status =="Delivered" and amount >0 :"Process payment to seller" )elif status =="Cancelled" :"Process refund to customer" )else :"Order still in progress — skip" )# One-line condition (ternary operator) order_type ="VIP" if amount >10000 else "Regular" f"Order type: {order_type}" )
# For loop — for each item in a list cities = ["Mumbai" ,"Delhi" ,"Hyderabad" ]for city in cities :f"Processing orders for: {city}" )# For loop with range — repeat N times for i in range (1 ,6 ):# 1 to 5 f"Retry attempt {i}" )# Loop through list of orders with index orders = [5000 ,12000 ,3500 ,8900 ]for index ,amount in enumerate (orders ,1 ):f"Order {index}: ₹{amount}" )# While loop — keep running until condition is False retry_count =0 success =False while retry_count <3 and not success :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 ]f"High value orders: {high_value}" )# [12000, 8900, 15000]
# 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" 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 :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 math .ceil (4.2 ))# 5 → round up math .floor (4.9 ))# 4 → round down math .sqrt (16 ))# 4.0 → square root
# ── Multithreading — good for I/O tasks (file read, API calls) ──── import threading import time def download_file (filename ):f"Downloading {filename}..." )time .sleep (2 )# simulate download time 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 "All files downloaded!" )# ── Multiprocessing — good for CPU-heavy tasks ──────────────────── from multiprocessing import Pool def process_city_data (city ):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 )results )
| 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) |