AI Logic School

Empowering Students with AI & Computational Thinking

CBSE Class 12 AI Practical File 2025-26 | Python Programs PDF | Code 843

📘 AI Logic School

CBSE Class 12 AI Python Programs
Practical File 2025–26

Complete Python practical file for CBSE Class 12 Artificial Intelligence. Subject Code 843. All programs with code, output and theory explanation.

20+
Programs
843
Subject Code
100%
CBSE
Free
Download

📥 Download Class 12 AI Practical File PDF — Free

Complete file with all programs, code, output, theory and viva questions. Prepared as per CBSE Code 843 official syllabus 2025-26.

⬇️ Download Free PDF

Class XII | Subject: Artificial Intelligence | Code: 843 | Session 2025-26
All programs are written in Python 3 using libraries like Pandas, NumPy, Matplotlib, Scikit-learn, and more. Each program includes aim, code, output and explanation. This practical file covers all units of the CBSE Class 12 AI syllabus.

Class 12 AI Subject Code 843 Python Practical File CBSE 2025-26 Pandas Programs Machine Learning Data Science Free PDF Download

📋 What is Included in This Practical File

This Class 12 AI Practical File (Code 843) covers all major topics of the CBSE syllabus — from basic Pandas DataFrames to advanced Machine Learning algorithms. Every program has a clear aim, working Python code, expected output, and a brief theory section to help students understand the concept before the practical exam.

🐍 All Python Programs — Complete List

Program 1–3
Pandas DataFrame Programs
Create DataFrame, access rows/columns, add/delete columns, filter data using conditions.
Pandas
Program 4–5
CSV File Handling
Read CSV files using pandas, display first/last rows, get dataset info and shape.
Pandas
Program 6
Missing Values Handling
Detect null values using isnull(), fill missing data with mean/median using fillna().
Pandas · NumPy
Program 7
Statistical Analysis
Calculate mean, median, mode, standard deviation, variance using NumPy and SciPy.
NumPy · SciPy
Program 8–11
Data Visualisation Charts
Bar chart, Pie chart, Line graph, and Scatter plot using Matplotlib with labels and titles.
Matplotlib
Program 12
Linear Regression
Predict values using Linear Regression model. Train/test split, fit model, evaluate accuracy.
Scikit-learn
Program 13
KNN Classifier
K-Nearest Neighbours classification on dataset. Predict class label with accuracy score.
Scikit-learn
Program 14
Decision Tree
Build Decision Tree classifier, visualise the tree, check accuracy on test data.
Scikit-learn
Program 15
Confusion Matrix
Evaluate model performance using confusion matrix, precision, recall and F1 score.
Scikit-learn
Program 16
Word Cloud
Generate a word cloud from text data to visualise most frequent words using wordcloud library.
WordCloud
Program 17
Data Story — MDMS
Complete data analysis story on Mid-Day Meal Scheme dataset covering all 5 AI Project Cycle steps.
Pandas · Matplotlib
Program 18
K-Means Clustering
Unsupervised learning using K-Means. Group data into clusters and visualise results.
Scikit-learn
Program 19
Gemini AI Chatbot
Build a chatbot using Google Gemini API. Send prompts and receive AI-generated responses in Python.
Google Gemini API

📊 CBSE Class 12 AI Syllabus — Code 843

Unit Topic Key Concepts Marks
Unit 1 Introduction to AI AI concepts, applications, ethics, bias 10
Unit 2 Data Science Methodology AI Project Cycle, Pandas, NumPy, Matplotlib 15
Unit 3 Computer Vision OpenCV, image processing, CNN basics 10
Unit 4 Natural Language Processing Text processing, NLTK, chatbots 10
Unit 5 Machine Learning Regression, KNN, Decision Tree, K-Means 15
Total Theory60 Marks

📝 Practical Exam Marks Distribution

ComponentDetailsMarks
Practical FileMinimum 15 programs with aim, code and output10
Practical ExamPython program on Data Science / ML15
Viva VoceQuestions on practical programs5
Project WorkAI project related to SDGs10
Total Practical40 Marks

⚙️ Python Libraries Required

Install all libraries before starting: Open Command Prompt and run these commands one by one:

pip install pandas   pip install numpy   pip install matplotlib   pip install scikit-learn   pip install wordcloud   pip install scipy

❓ Important Viva Questions — Class 12 AI Code 843

Q1. What is a Pandas DataFrame?
A DataFrame is a 2-dimensional labelled data structure in Pandas — like a table with rows and columns. It is the most commonly used object in data science.
Q2. What is the difference between isnull() and fillna()?
isnull() detects missing values and returns True/False. fillna() replaces missing values with a specified value like mean or median.
Q3. What is Linear Regression?
Linear Regression is a supervised ML algorithm that predicts a continuous output value based on input features by finding the best-fit straight line.
Q4. What is KNN? What does K stand for?
KNN stands for K-Nearest Neighbours. K is the number of nearest data points used to classify a new data point based on majority class.
Q5. What is a Decision Tree?
A Decision Tree is a supervised ML algorithm that splits data into branches based on feature values to make predictions — like a flowchart.
Q6. What is a Confusion Matrix?
A Confusion Matrix shows the performance of a classification model — displaying True Positives, True Negatives, False Positives and False Negatives.
Q7. What is K-Means Clustering?
K-Means is an unsupervised ML algorithm that groups data into K clusters based on similarity. It does not use labelled data.
Q8. What is the AI Project Cycle?
The 5 steps are: Problem Scoping → Data Acquisition → Data Exploration → Modelling → Evaluation.
Q9. What is train_test_split?
It divides the dataset into training data (to build the model) and testing data (to evaluate its accuracy). Typically 80% train, 20% test.
Q10. What is overfitting in Machine Learning?
Overfitting occurs when a model performs very well on training data but poorly on new/test data — it has memorised the training data instead of learning patterns.

📥 Download Complete Class 12 AI Practical File — Free

All 20+ programs with aim, code, output, theory and viva questions. 100% CBSE Code 843 aligned. Session 2025-26.

⬇️ Download Free PDF

🔗 More Free Resources — AI Logic School

📗 CLASS 9
Class 9 AI Practical File
15 Python programs for CBSE Class 9 AI Code 417 with output.
📘 CLASS 10
Class 10 AI Practical File
15 Python programs for CBSE Class 10 AI Code 417 with output.
📙 WORKSHEETS
CBSE AI Worksheets
Free printable worksheets for Classes 6 to 12 AI and CT subjects.

Data Science with Python

CBSE · SUB CODE 843 · CLASS 11 · UNIT 3 & 5

Data Science with Python

NumPy · Pandas · Matplotlib · Statistics — with real-world examples

NumPy Pandas Matplotlib Statistics CSV Files
WHAT IS DATA SCIENCE?

Data Science is the process of collecting, cleaning, analysing and visualising data to find useful insights and make decisions. Python is the most popular language for Data Science because of its powerful libraries.

LIBRARY 1

NumPy — Numerical Python

🌡️ DAILY LIFE EXAMPLE — Temperature Tracker

You recorded temperature for 7 days in your city: 38, 40, 37, 42, 39, 41, 36°C. NumPy helps you find average temperature, maximum, minimum in just one line of code — like a super calculator for lists of numbers!

import numpy as np

# 7 days temperature data (in Celsius)
temperature = np.array([38, 40, 37, 42, 39, 41, 36])

print("All temperatures:", temperature)
print("Average temp:   ", np.mean(temperature))      # 39.0
print("Maximum temp:   ", np.max(temperature))       # 42
print("Minimum temp:   ", np.min(temperature))       # 36
print("Std Deviation:  ", np.std(temperature))       # spread of data

# Array operations - add 2 degrees to all values
print("If +2 degrees:  ", temperature + 2)
IMPORTANT NUMPY FUNCTIONS — MUST KNOW
FunctionWhat it doesExample
np.array()Create an arraynp.array([1,2,3])
np.mean()Calculate averagenp.mean([10,20,30]) → 20
np.median()Find middle valuenp.median([1,3,5]) → 3
np.std()Standard deviationnp.std([2,4,4,4,5,5,7,9]) → 2
np.var()Variancenp.var(data)
np.arange()Create number sequencenp.arange(1,10,2) → [1,3,5,7,9]
LIBRARY 2

Pandas — Data Analysis Library

📊 DAILY LIFE EXAMPLE — Student Report Card

Think of Pandas like a super Excel sheet in Python. Your school has data of 500 students — name, marks, attendance, class. Pandas lets you load this data, filter students who scored above 80%, find the class average, and sort by marks — all with just a few lines of code!

import pandas as pd

# Create a student DataFrame (like a table)
data = {
    'Name':    ['Aarav','Priya','Rahul','Sneha','Arjun'],
    'Marks':   [85, 92, 78, 95, 88],
    'Subject': ['AI','AI','AI','AI','AI'],
    'Class':   [11, 11, 11, 11, 11]
}
df = pd.DataFrame(data)

print(df)                           # Show full table
print("\nAverage marks:", df['Marks'].mean())
print("Top scorer:", df['Name'][df['Marks'].idxmax()])

# Filter students with marks above 85
toppers = df[df['Marks'] > 85]
print("\nToppers:\n", toppers)
READING CSV FILES WITH PANDAS

CSV (Comma Separated Values) is a simple file format for storing data — like a spreadsheet saved as plain text. Example: student_data.csv contains hundreds of rows of student information.

import pandas as pd

# Load data from CSV file
df = pd.read_csv('student_data.csv')

print(df.head())         # First 5 rows
print(df.tail())         # Last 5 rows
print(df.shape)          # (rows, columns)
print(df.describe())     # Statistics summary
print(df.isnull().sum()) # Check missing values

# Save to new CSV
df.to_csv('cleaned_data.csv', index=False)
MUST-KNOW PANDAS FUNCTIONS
FunctionPurpose
df.head(n)Show first n rows (default 5)
df.describe()Show count, mean, std, min, max of all columns
df.shapeReturns (number of rows, number of columns)
df.isnull()Find missing/empty values in data
df.dropna()Remove rows with missing values
df.fillna(value)Fill missing values with a specific value
LIBRARY 3

Matplotlib — Data Visualization

📈 DAILY LIFE EXAMPLE — Class Performance Graph

Your teacher wants to show how the class performed in 5 subjects. Instead of showing a boring table of numbers, Matplotlib creates a bar graph or pie chart — making it easy to see which subject students did best in!

5 TYPES OF GRAPHS — CBSE SYLLABUS
1. LINE GRAPH
import matplotlib.pyplot as plt

months = ['Jan','Feb','Mar','Apr']
sales  = [200, 350, 300, 450]

plt.plot(months, sales, marker='o')
plt.title('Monthly Sales')
plt.xlabel('Month')
plt.ylabel('Sales')
plt.show()
2. BAR GRAPH
import matplotlib.pyplot as plt

subjects = ['Maths','AI','English',
            'Science','Hindi']
marks    = [85, 92, 78, 88, 76]

plt.bar(subjects, marks, color='teal')
plt.title('Subject-wise Marks')
plt.ylabel('Marks')
plt.show()
3. PIE CHART
import matplotlib.pyplot as plt

labels  = ['Pass','Fail','Absent']
sizes   = [75, 15, 10]
colors  = ['green','red','gray']

plt.pie(sizes, labels=labels,
        colors=colors, autopct='%1.1f%%')
plt.title('Exam Results')
plt.show()
4. HISTOGRAM
import matplotlib.pyplot as plt

marks = [45,55,60,65,70,70,75,
         80,80,80,85,90,90,95]

plt.hist(marks, bins=5,
         color='steelblue')
plt.title('Marks Distribution')
plt.xlabel('Marks Range')
plt.ylabel('Number of Students')
plt.show()
5. SCATTER PLOT
import matplotlib.pyplot as plt

study_hours = [2,3,4,5,6,7,8]
exam_marks  = [50,55,65,70,78,85,92]

plt.scatter(study_hours, exam_marks,
            color='purple')
plt.title('Study Hours vs Marks')
plt.xlabel('Hours Studied')
plt.ylabel('Marks Scored')
plt.show()
UNIT 5

Statistics for Data Science

🎯 DAILY LIFE EXAMPLE — Cricket Match Scores

Virat Kohli scored these runs in 7 matches: 45, 82, 67, 23, 95, 56, 38. Let's calculate the key statistics to understand his performance!

import numpy as np
from scipy import stats

# Virat's runs in 7 matches
runs = np.array([45, 82, 67, 23, 95, 56, 38])

mean     = np.mean(runs)      # Average: 58.0
median   = np.median(runs)    # Middle value: 56.0
mode_val = stats.mode(runs)   # Most frequent (no repeat here)
std_dev  = np.std(runs)       # How spread out: ~23.6
variance = np.var(runs)       # Variance: ~557

print(f"Mean (Average):      {mean:.1f} runs")
print(f"Median (Middle):     {median:.1f} runs")
print(f"Standard Deviation:  {std_dev:.1f} runs")
print(f"Variance:            {variance:.1f}")

# Interpretation:
# High std deviation = inconsistent player
# Low std deviation  = consistent player
MEAN

Sum of all values ÷ count. Like sharing pizza equally among friends.

🎯
MEDIAN

Middle value when sorted. Used for salaries to avoid effect of very high earners.

🔁
MODE

Most frequent value. Like the most popular shoe size in a shop.

📏
STD DEV

How spread out data is from the mean. Low = consistent, High = spread out.

EXAM TIPS — DATA SCIENCE
  • NumPy = for numerical operations on arrays and matrices
  • Pandas = for tabular data (rows and columns) — like Excel in Python
  • Matplotlib = for creating graphs and charts
  • CSV = Comma Separated Values — most common data file format
  • df.head() shows first 5 rows | df.describe() shows statistics
  • Always check for missing values with df.isnull().sum() before analysis
AI Logic School · Data Science with Python · CBSE Class 11 · Sub Code 843 · Units 3 & 5

Senior Secondary: Python & Data Science Hub

💻 Senior Secondary Tech Lab

Advanced Python, Data Science, and AI for Classes 11 & 12

📊 Data Science with Python

Master Pandas and NumPy. Learn to analyze datasets, handle CSV files, and visualize trends using PyPlot.

import pandas as pd
df = pd.read_csv('data.csv')
Explore Tutorials

🧠 Machine Learning Basics

Understand Regression, Classification, and Neural Networks. We break down complex math into simple logic.

Read Theory

📂 Practical File Solutions

The complete 2025-26 Python Practical List. Solved programs with output screenshots for your lab internal exams.

Download List

🚀 Career Spotlight: AI & Data Science

Why learn this? The skills you build in Class 12 are the foundation for careers in:

  • Data Analysis
  • Software Engineering
  • AI Research
  • Cyber Forensics
Chat on WhatsApp