CBSE Class 11 Informatics Practices Practical File, Python and SQL with Output
The CBSE Class 11 Informatics Practices (065) practical file mixes Python basics, an introduction to pandas, and SQL. Every program below was run and its output captured, so what you copy is what it will print.
1. Print a table of a number using a loop
n = 7
for i in range(1, 11):
print(n, "x", i, "=", n * i)7 x 1 = 7 7 x 2 = 14 7 x 3 = 21 7 x 4 = 28 7 x 5 = 35 7 x 6 = 42 7 x 7 = 49 7 x 8 = 56 7 x 9 = 63 7 x 10 = 70
2. Find the average of numbers entered in a list
marks = [72, 85, 66, 90, 58]
print("Marks:", marks)
print("Average:", round(sum(marks) / len(marks), 2))Marks: [72, 85, 66, 90, 58] Average: 74.2
3. Swap two variables without a third variable
a, b = 15, 40
print("Before swap: a =", a, ", b =", b)
a, b = b, a
print("After swap : a =", a, ", b =", b)Before swap: a = 15 , b = 40 After swap : a = 40 , b = 15
4. Create a pandas Series from a dictionary
import pandas as pd
s = pd.Series({"Maths": 88, "Science": 74, "English": 91})
print(s)
print("Total:", s.sum())Maths 88 Science 74 English 91 dtype: int64 Total: 253
5. Display the first and last rows of a DataFrame
import pandas as pd
df = pd.DataFrame({"City": ["Ahmedabad", "Surat", "Rajkot", "Vadodara"],
"Students": [120, 90, 64, 78]})
print("First two rows:")
print(df.head(2))
print("Last row:")
print(df.tail(1))First two rows:
City Students
0 Ahmedabad 120
1 Surat 90
Last row:
City Students
3 Vadodara 786. Count how many values are above average
import pandas as pd
df = pd.DataFrame({"Marks": [78, 91, 45, 66, 88]})
avg = df["Marks"].mean()
print("Average:", avg)
print("Above average:", int((df["Marks"] > avg).sum()), "students")Average: 73.6 Above average: 3 students
7. SQL: create a table and filter with WHERE
CREATE TABLE books(id INTEGER, title TEXT, price INTEGER);
INSERT INTO books VALUES (1,'Python Basics',450),(2,'SQL Simplified',320),
(3,'Data Handling',560);
SELECT title, price FROM books WHERE price > 400;title price ------------- ----- Python Basics 450 Data Handling 560
8. SQL: UPDATE and DELETE a row
CREATE TABLE books(id INTEGER, title TEXT, price INTEGER); INSERT INTO books VALUES (1,'Python Basics',450),(2,'SQL Simplified',320); UPDATE books SET price = 400 WHERE id = 1; DELETE FROM books WHERE id = 2; SELECT * FROM books;
id title price -- ------------- ----- 1 Python Basics 400
Get the full practical-file pack, free
Every program, the exact practical-file format your school expects, and the viva questions that come up most — sent on WhatsApp.
Get it on WhatsApp Book a free demo classRelated: Class 11 IP syllabus · IP Class 11 weightage · Class 12 IP practical file
Stuck on your practical file or the viva?
Kajal Ma'am has been teaching these practicals since 2004. See a real class first — no payment, no commitment.
Book a free demo class
