Target: 100/100 in CBSE Boards. 🎯
Years of structured teaching compressed into one intelligent revision hub.
Reviewing the fundamentals: Tokens, Flow of Control, and Mutable/Immutable types.
| Token Type | Examples |
|---|---|
| Keywords | if, while, for, break |
| Identifiers | myVar, _count, totalMarks |
| Literals | 12, 3.14, "Hello", True |
| Operators | +, -, *, //, ** |
Board Exam Secret:
1-mark questions frequently test Invalid Identifiers.
L = [10, 20, 30, 40, 50, 60]
print(L[1:5]) # Output: [20, 30, 40, 50]
print(L[::-1]) # Output: [60, 50, 40, 30, 20, 10]
print(L[2:]) # Output: [30, 40, 50, 60]
A function is a reusable block of code that performs a specific task. They are the building blocks of modular programming, helping to break complex problems into smaller, manageable pieces (e.g., `calc_tax()`, `send_email()`).
Pre-defined in Python.
print(), len(), type()
Imported from libraries.
math.sqrt(), random.randint()
Created by programmers.
def my_func():
Topic: Scope of Variables
Board exams frequently test if you know when a variable is Local or Global.
global keyword first.
def factorial(n):
result = 1
# Loop from 1 to n
for i in range(1, n + 1):
result *= i
return result # Returns final value
num = 5
# Function Call
print("Factorial:", factorial(num))
# Output: Factorial: 120
Reading/Writing persistent data. Text files (`read()`, `readlines()`), Binary (`pickle`), and CSV modules are guaranteed 3-5 mark questions.
import pickle
def search_record(roll_no):
found = False
try:
with open('student.dat', 'rb') as f:
while True:
rec = pickle.load(f)
if rec['roll'] == roll_no:
print("Found:", rec)
found = True
break
except EOFError:
pass
if not found:
print("Record not found.")
Binary File Trap: Always use `try-except EOFError` block when reading binary files with `pickle.load()` inside a loop. Without it, your program will crash at the end of file.
Stack is a linear data structure that follows the LIFO (Last In First Out) principle. Conceptualize it like a stack of plates: the last plate placed on top is the first one removed.
Board Implementation:
In Python board exams, Stack is always implemented using a List.
list.append(item)list.pop()
s = []
def push():
item = int(input("Enter element: "))
s.append(item)
print("Stack after push:", s)
def pop_element():
if len(s) == 0:
print("Underflow - Stack is empty")
else:
print("Popped element:", s.pop())
def display():
if len(s) == 0:
print("Stack is empty")
else:
print("Stack elements:", s)
while True:
print("\n1. Push\n2. Pop\n3. Display\n4. Exit")
choice = int(input("Enter choice: "))
if choice == 1:
push()
elif choice == 2:
pop_element()
elif choice == 3:
display()
elif choice == 4:
break
else:
print("Invalid choice")
Structured Query Language involving `SELECT`, `GROUP BY`, `HAVING`, and Python-SQL connectivity (`mysql.connector`).
import mysql.connector as sqlt
con = sqlt.connect(host='localhost', user='root', passwd='password', database='school')
cursor = con.cursor()
cursor.execute("SELECT * FROM Student WHERE Marks > 90")
data = cursor.fetchall()
for row in data:
print(row)
con.close()
Query Trap: `WHERE` clause filters rows *before* grouping. `HAVING` clause filters groups *after* grouping. Mixing them up results in 0 marks for that query.
| Type | Full Form | Range | Example |
|---|---|---|---|
| PAN | Personal Area | ~10 m | Bluetooth |
| LAN | Local Area | Building | Office Wi-Fi |
| MAN | Metropolitan | City | Cable TV |
| WAN | Wide Area | Global | Internet |
"Memory Trick: PAN = Personal, LAN = Local, MAN = Metropolitan, WAN = World."
All nodes connect to a central Hub/Switch.
Single cable (backbone) connects all nodes.
Hierarchical structure (Bus + Star).
| Feature | IP Address | MAC Address |
|---|---|---|
| Type | Logical (Software) | Physical (Hardware) |
| Assigned | ISP / Network | Manufacturer |
| Changeable | Yes | No |
"Board exam mein 4-5 marks ka ek 'Case Study' question hamesha aata hai jisme Layout design karna hota hai."
Golden Rules:
Buildings: A (25 PCs), B (40 PCs), C (15 PCs), D (20 PCs)
Distances: A-B (50m), A-C (120m), B-D (80m), C-D (60m)