Class 10 AI Practical File 2025-26 | 15 Python Programs with Output | CBSE Code 417
📘 Class 10 AI Practical File
15 Python Programs with Output
Based on Official CBSE Syllabus · Basics to Advanced · Free PDF Download
Google Drive · Class10_AI_Practical_File_2025-26.pdf
| Component | Sub-Component | Marks |
|---|---|---|
| Part C — Practical Work | Practical File (min. 15 programs) | 15 |
| Practical Exam — Unit 3: Advance Python | 5 | |
| Practical Exam — Unit 4: Data Science | 5 | |
| Practical Exam — Unit 5: Computer Vision | 5 | |
| Part C — Viva Voce | Questions on programs and concepts | 5 |
| Part D — Project Work | Project / Field Visit / Portfolio | 10 |
| Part D — Viva Voce | Project viva | 5 |
| GRAND TOTAL (Practical) | 50 Marks | |
Go to python.org/downloads → Download Python 3.x for your OS (Windows / Mac / Linux).
⚠️ Windows users: tick "Add Python to PATH" before clicking Install.
Windows: Press Win + R → type cmd → press Enter.
Mac/Linux: Open Terminal from Applications.
Type and press Enter: pip install notebook
Run these one by one:
pip install numpy pip install matplotlib pip install pandas pip install Pillow pip install scipy
Type: jupyter notebook — Jupyter opens automatically in your browser.
Click New → Python 3. Type code in a cell and press Shift + Enter to run.
Press Ctrl + S. Your file saves as a .ipynb notebook in the current folder.
| # | Program Title | Level | CBSE Unit |
|---|---|---|---|
| 1 | Add Elements of Two Lists | Basic | Unit 3 — Advance Python |
| 2 | Arithmetic Operations on Lists (Sub, Mul, Div) | Basic | Unit 3 — Advance Python |
| 3 | Mean, Median & Mode using NumPy | Basic | Unit 4 — Data Science |
| 4 | Standard Deviation & Variance using NumPy | Basic | Unit 4 — Data Science |
| 5 | Line Chart — (2,5) to (9,10) | Basic | Unit 4 — Data Science |
| 6 | Scatter Chart — 5 Points | Basic | Unit 4 — Data Science |
| 7 | Bar Chart — Student Marks | Intermediate | Unit 4 — Data Science |
| 8 | Pie Chart — Subject Survey | Intermediate | Unit 4 — Data Science |
| 9 | Read CSV & Display 10 Rows | Intermediate | Unit 4 — Data Science |
| 10 | Read CSV — Info & Descriptive Statistics | Intermediate | Unit 4 — Data Science |
| 11 | Data Cleaning — Handle Missing Values | Intermediate | Unit 4 — Data Science |
| 12 | Read & Display Image using Python (PIL) | Intermediate | Unit 5 — Computer Vision |
| 13 | Identify Image Shape & Properties | Intermediate | Unit 5 — Computer Vision |
| 14 | Multi-Chart Dashboard from CSV Data | Advanced | Unit 4 — Data Science |
| 15 | Mini Data Story — Full Analysis Pipeline | Advanced | Unit 4 + Unit 2 (AI Project Cycle) |
📥 All 15 programs with full code, expected output, theory and viva questions are available in the free PDF.
Download Free PDF NowAdd Elements of Two Lists
BasicA list is Python's most versatile data structure. Adding two lists element-by-element is a foundational operation in Data Science — it mimics vector addition used in NumPy and ML algorithms.
# Program 1: Add elements of two lists list1 = [10, 20, 30, 40, 50] list2 = [5, 15, 25, 35, 45] result = [] for i in range(len(list1)): result.append(list1[i] + list2[i]) print('List 1 :', list1) print('List 2 :', list2) print('Sum :', result)
List 1 : [10, 20, 30, 40, 50] List 2 : [5, 15, 25, 35, 45] Sum : [15, 35, 55, 75, 95]
Mean, Median & Mode using NumPy
BasicThese are the three measures of central tendency in statistics — essential for Unit 4 (Data Science). Mean = average; Median = middle value; Mode = most frequent value. NumPy provides fast, vectorized calculations on datasets.
# Program 3: Mean, Median and Mode using NumPy import numpy as np from scipy import stats data = [12, 15, 14, 10, 18, 14, 20, 14, 11, 16] mean = np.mean(data) median = np.median(data) mode = stats.mode(data, keepdims=True) print('Data :', data) print('Mean :', mean) print('Median :', median) print('Mode :', mode.mode[0], ' (appears', mode.count[0], 'times)')
Data : [12, 15, 14, 10, 18, 14, 20, 14, 11, 16] Mean : 14.4 Median : 14.0 Mode : 14 (appears 3 times)
Line Chart — (2,5) to (9,10)
BasicA line chart visualises trends by connecting data points. Matplotlib's plt.plot() is the standard function. Used in Data Exploration (Unit 4) to visualise patterns across continuous data.
# Program 5: Line Chart from (2,5) to (9,10) import matplotlib.pyplot as plt x = [2, 9] y = [5, 10] plt.figure(figsize=(6, 4)) plt.plot(x, y, color='blue', linewidth=2, marker='o', markersize=8, label='Line') plt.title('Line Chart: (2,5) to (9,10)') plt.xlabel('X - Axis') plt.ylabel('Y - Axis') plt.grid(True, linestyle='--', alpha=0.6) plt.legend() plt.tight_layout() plt.show()
A line chart is displayed connecting (2,5) to (9,10) with circular markers at each point, grid, title and legend.
Scatter Chart — 5 Points
BasicA scatter chart plots individual data points on an X-Y plane to show patterns, clusters, or correlations — a fundamental technique in Data Exploration and Machine Learning.
# Program 6: Scatter Chart import matplotlib.pyplot as plt x = [2, 9, 8, 5, 6] y = [5, 10, 3, 7, 18] plt.figure(figsize=(6, 4)) plt.scatter(x, y, color='red', s=100, edgecolors='black', linewidths=1) for i in range(len(x)): plt.annotate(f'({x[i]},{y[i]})', (x[i], y[i]), textcoords='offset points', xytext=(6,6), fontsize=8) plt.title('Scatter Chart') plt.xlabel('X - Axis') plt.ylabel('Y - Axis') plt.grid(True, linestyle='--', alpha=0.5) plt.tight_layout() plt.show()
Scatter chart with 5 red annotated points: (2,5) (9,10) (8,3) (5,7) (6,18)
Read CSV & Display 10 Rows
IntermediateReading a CSV file is the very first step in any Data Science project. Pandas' read_csv() loads the data into a DataFrame and head(10) previews the first 10 rows — Step 1 of the AI Project Cycle (Data Acquisition).
# Program 9: Read CSV and display 10 rows import pandas as pd # Replace 'data.csv' with your actual file path df = pd.read_csv('data.csv') print('First 10 rows:') print('=' * 50) print(df.head(10)) print('\nShape :', df.shape) print('Columns:', list(df.columns))
First 10 rows: ================================================== Name Age Marks Grade 0 Aarav 15 85 A 1 Diya 15 92 A 2 Rohan 14 78 B ... (10 rows total) Shape : (50, 4) Columns: ['Name', 'Age', 'Marks', 'Grade']
Read CSV — Display its Information
Intermediatedf.info() shows column names, data types and null value counts. df.describe() gives statistical summary. These are critical for Data Exploration — Step 3 of the CBSE AI Project Cycle.
# Program 10: CSV Information and Statistics import pandas as pd df = pd.read_csv('data.csv') print('--- Dataset Information ---') print(df.info()) print('\n--- Descriptive Statistics ---') print(df.describe()) print('\n--- Missing Values ---') print(df.isnull().sum()) print('\n--- Data Types ---') print(df.dtypes)
--- Dataset Information ---
RangeIndex: 50 entries
Columns: Name, Age, Marks, Grade (4 columns)
--- Descriptive Statistics ---
Age Marks
mean 14.80 75.40
std 0.40 12.30
min 14.00 45.00
max 15.00 99.00
--- Missing Values ---
Marks 2 | Grade 0 | Name 0Read & Display Image using Python
IntermediateImages are a key data type in Computer Vision (Unit 5). Pillow (PIL) reads image files and Matplotlib displays them. Every image is a 3D NumPy array of pixel values (Height × Width × Channels).
# Program 12: Read and Display Image from PIL import Image import matplotlib.pyplot as plt # Replace 'image.jpg' with your image file path img = Image.open('image.jpg') plt.figure(figsize=(6, 5)) plt.imshow(img) plt.title('Displayed Image') plt.axis('off') plt.tight_layout() plt.show() print('Format :', img.format) print('Mode :', img.mode) print('Size :', img.size)
Image is displayed in Matplotlib window. Format : JPEG Mode : RGB Size : (1920, 1080)
Identify Image Shape using Python
IntermediateAn image in Python is a NumPy array. The shape property gives (Height, Width, Channels). For RGB images, Channels = 3. For Grayscale, Channels = 1. This is the foundation of Computer Vision in Unit 5.
# Program 13: Identify Image Shape from PIL import Image import numpy as np img = Image.open('image.jpg') arr = np.array(img) print('Image Shape (H×W×C) :', arr.shape) print('Height in pixels :', arr.shape[0]) print('Width in pixels :', arr.shape[1]) print('Number of Channels :', arr.shape[2]) print('Total Pixels :', arr.shape[0] * arr.shape[1]) print('Data Type :', arr.dtype) print('Min Pixel Value :', arr.min()) print('Max Pixel Value :', arr.max())
Image Shape (H×W×C) : (1080, 1920, 3) Height in pixels : 1080 Width in pixels : 1920 Number of Channels : 3 Total Pixels : 2073600 Data Type : uint8 Min Pixel Value : 0 Max Pixel Value : 255
📥 Download Complete Practical File
All 15 Programs · Aim · Code · Expected Output · Theory · Viva Questions · Marking Scheme · Jupyter Guide
Download Free PDF — Google DriveClass10_AI_Practical_File_2025-26.pdf · Free · No login required
Comments
Post a Comment