ACKNOWLEDGEMENT
I wish to express my deep sense of gratitude
and indebtedness to our learned teacher
MS. ADITI TIWARI, TGT COMPUTER
INSTRUCTOR, SARASWATI VIDYA MANDIR
INTER COLLEGE for his invaluable help, advice
and guidance in the preparation of this
project.
I am also greatly indebted to our principal MRS.
KOMAL CHANDIOK SHARMA and school
authorities for providing me with the
facilities and requisite laboratory conditions
for making this practical file.
I also extend my thanks to a number of
teachers, my classmates and friends who
helped me to complete this practical file
successfully.
[Name of Student]
CERTIFICATE
This is to certify that __________________of Class 10-___,
Roll No. _____, has successfully completed the Artificial
Intelligence (AI) Practical Work for the academic year
20___–20___ as prescribed by the Central Board of
Secondary Education (CBSE).
The practical file includes all required activities, hands-on
exercises, AI worksheets, projects, and assessments in
accordance with the CBSE curriculum. The student has
shown sincere effort and active participation throughout the
completion of this practical work.
Teacher In-Charge
Name:
Signature:
Date:
School Principal
Name:
Signature:
Date:
INDEX
CBSE Class 10 – Artificial Intelligence (AI) Practical File
S. No. Practical Activity / Topic Page No.
Part A – Python Programming Activities
1 Introduction to Python & Basic Syntax
10
11
12
13
14
15
16
Part-B: Computer Vision
S. No. Practical Activity / Topic Page No.
🐍 Introduction to Python
Python is one of the most popular programming languages in the world. It’s known for being:
Easy to read and write
Beginner-friendly
Versatile — used for web development, data science, AI, automation, game
development, and more.
Python emphasizes readability, which is why many new programmers start with it.
🧱 Basic Python Syntax
Below are the essential pieces of Python syntax you'll use all the time.
✔️1. Printing Output
print("Hello, world!")
print() displays text or values on the screen.
✔️2. Variables
You don’t need to declare variable types — Python figures it out automatically.
name = "Alice"
age = 20
height = 5.7
✔️3. Data Types
Common types include:
Type Example
int (integer) 10
float 3.14
str (string) "Hello"
bool True or False
✔️4. Comments
Comments help describe what your code does.
# This is a single-line comment
✔️5. Taking Input
name = input("Enter your name: ")
print("Hello,", name)
✔️6. If/Else Conditions
x = 10
if x > 5:
print("x is greater than 5")
else:
print("x is not greater than 5")
Python uses indentation instead of braces {} — this is mandatory.
✔️7. Loops
For Loop
for i in range(5):
print(i)
While Loop
count = 1
while count <= 5:
print(count)
count += 1
✔️8. Functions
def greet(name):
print("Hello,", name)
greet("Alice")
Functions are defined using def.
✔️9. Lists (Arrays in Python)
fruits = ["apple", "banana", "cherry"]
print(fruits[0]) # apple
✔️10. Indentation Rules
Python enforces indentation!
Typically 4 spaces.
if True:
print("Indented block")
Write any 15 programs in practical file:
1. Program to Calculate Simple Interest
p = float(input("Enter Principal: "))
r = float(input("Enter Rate: "))
t = float(input("Enter Time: "))
si = (p * r * t) / 100
print("Simple Interest =", si)
Output:
Enter Principal: 12000
Enter Rate: 5
Enter Time: 12
Simple Interest = 7200.0
2. Program to Display Multiplication Table
n = int(input("Enter a number: "))
for i in range(1, 11):
print(n, "x", i, "=", n*i)
Output:
Enter a number: 15
15 x 1 = 15
15 x 2 = 30
15 x 3 = 45
15 x 4 = 60
15 x 5 = 75
15 x 6 = 90
15 x 7 = 105
15 x 8 = 120
15 x 9 = 135
15 x 10 = 150
3. Program to Count Vowels in a String
text = input("Enter text: ")
vowels = "aeiouAEIOU"
count = 0
for ch in text:
if ch in vowels:
count += 1
print("Number of vowels =", count)
Output:
Enter text: Kanpur
Number of vowels = 2
4. Program to Print Fibonacci Series (First 10 Terms)
a, b = 0, 1
print(a, b, end=" ")
for _ in range(8):
c=a+b
print(c, end=" ")
a, b = b, c
Output:
0 1 1 2 3 5 8 13 21 34
5. Program to Find Factorial of a Number
num = int(input("Enter a number: "))
fact = 1
for i in range(1, num + 1):
fact *= i
print("Factorial =", fact)
Output:
Enter a number: 7
Factorial = 5040
6. Program to Check Prime Number
num = int(input("Enter a number: "))
flag = True
if num < 2:
flag = False
else:
for i in range(2, num):
if num % i == 0:
flag = False
break
if flag:
print("Prime Number")
else:
print("Not Prime")
Output:
Enter a number: 153
Not Prime
7. Program to Find the Grade of a Student
name = input("Enter student name: ")
m1 = int(input("Enter marks in Maths: "))
m2 = int(input("Enter marks in Science: "))
m3 = int(input("Enter marks in English: "))
total = m1 + m2 + m3
avg = total / 3
print("\n--- Student Result ---")
print("Name:", name)
print("Total Marks:", total)
print("Average:", avg)
if avg >= 90:
print("Grade: A")
elif avg >= 75:
print("Grade: B")
elif avg >= 60:
print("Grade: C")
else:
print("Grade: D")
Output:
Enter student name: Amit Mishra
Enter marks in Maths: 94
Enter marks in Science: 98
Enter marks in English: 91
--- Student Result ---
Name: Amit Mishra
Total Marks: 283
Average: 94.33333333333333
Grade: A
8. Program for a Basic Calculator
print("---- BASIC CALCULATOR ----")
a = float(input("Enter first number: "))
b = float(input("Enter second number: "))
print("1. Addition")
print("2. Subtraction")
print("3. Multiplication")
print("4. Division")
choice = int(input("Choose an option: "))
if choice == 1:
print("Result =", a + b)
elif choice == 2:
print("Result =", a - b)
elif choice == 3:
print("Result =", a * b)
elif choice == 4:
if b != 0:
print("Result =", a / b)
else:
print("Cannot divide by zero!")
else:
print("Invalid choice")
Output:
---- BASIC CALCULATOR ----
Enter first number: 53
Enter second number: 63
1. Addition
2. Subtraction
3. Multiplication
4. Division
Choose an option: 3
Result = 3339.0
9. Program to Reverse a Number
num = int(input("Enter a number: "))
rev = 0
temp = num
while temp > 0:
digit = temp % 10
rev = rev * 10 + digit
temp //= 10
print("Original number =", num)
print("Reversed number =", rev)
Output:
Enter a number: 75395
Original number = 75395
Reversed number = 59357
10. Program to Count Words in a Sentence
sentence = input("Enter a sentence: ")
words = [Link]()
count = len(words)
print("Total words =", count)
Output:
Enter a sentence: India
Total words = 1
11. Program to Check Armstrong Number
num = int(input("Enter a number: "))
sum = 0
temp = num
while temp > 0:
digit = temp % 10
sum += digit ** 3
temp //= 10
if sum == num:
print(num, "is an Armstrong number")
else:
print(num, "is not an Armstrong number")
Output:
Enter a number: 5369
5369 is not an Armstrong number
12. Program to Create and Search an Element in a List
n = int(input("Enter number of elements: "))
lst = []
for i in range(n):
ele = int(input("Enter element: "))
[Link](ele)
key = int(input("Enter element to search: "))
if key in lst:
print(key, "is present in the list.")
else:
print(key, "is not found.")
Output:
Enter number of elements: 5
Enter element: 10
Enter element: 20
Enter element: 30
Enter element: 40
Enter element: 50
Enter element to search: 30
30 is present in the list.
13. Program to Calculate Area of Shapes (Menu Driven)
print("1. Area of Circle")
print("2. Area of Rectangle")
print("3. Area of Triangle")
choice = int(input("Choose an option: "))
if choice == 1:
r = float(input("Enter radius: "))
print("Area =", 3.14 * r * r)
elif choice == 2:
l = float(input("Enter length: "))
b = float(input("Enter breadth: "))
print("Area =", l * b)
elif choice == 3:
b = float(input("Enter base: "))
h = float(input("Enter height: "))
print("Area =", 0.5 * b * h)
else:
print("Invalid choice")
Output:
1. Area of Circle
2. Area of Rectangle
3. Area of Triangle
Choose an option: 2
Enter length: 14
Enter breadth: 35
Area = 490.0
14. Program to Calculate Electricity Bill
units = int(input("Enter electricity units consumed: "))
if units <= 100:
bill = units * 5
elif units <= 200:
bill = 100 * 5 + (units - 100) * 7
else:
bill = 100 * 5 + 100 * 7 + (units - 200) * 10
print("Total Bill Amount =", bill)
Output:
Enter electricity units consumed: 256
Total Bill Amount = 1760
15. Program to Count Even and Odd Numbers in a List
n = int(input("Enter number of elements: "))
lst = []
for i in range(n):
num = int(input("Enter number: "))
[Link](num)
even = 0
odd = 0
for x in lst:
if x % 2 == 0:
even += 1
else:
odd += 1
print("Even numbers:", even)
print("Odd numbers:", odd)
Output:
Enter number of elements: 5
Enter number: 35
Enter number: 63
Enter number: 95
Enter number: 78
Enter number: 12
Even numbers: 2
Odd numbers: 3
16. Program to Print Square Pattern of Numbers
n = int(input("Enter number of rows: "))
for i in range(1, n + 1):
for j in range(1, n + 1):
print(j, end=" ")
print()
Output:
Enter number of rows: 5
12345
12345
12345
12345
12345
17. Program to Generate a 4-Digit OTP
import random
otp = [Link](1000, 9999)
print("Your OTP is:", otp)
Output:
Your OTP is: 1666
18. Program to Convert a Sentence to Uppercase and Lowercase
sentence = input("Enter a sentence: ")
print("Uppercase:", [Link]())
print("Lowercase:", [Link]())
Output:
Enter a sentence: This is kanpur
Uppercase: THIS IS KANPUR
Lowercase: this is kanpur
19. Program to Convert Celsius to Fahrenheit
c = float(input("Enter temperature in Celsius: "))
f = (c * 9/5) + 32
print("Temperature in Fahrenheit:", f)
Output:
Enter temperature in Celsius: 35
Temperature in Fahrenheit: 95.0
20. Program to Print All Numbers Divisible by 3 and 5 (1 to 100)
print("Numbers divisible by both 3 and 5:")
for i in range(1, 101):
if i % 3 == 0 and i % 5 == 0:
print(i)
Output:
Numbers divisible by both 3 and 5:
15
30
45
60
75
90
Introduction to Computer Vision
Computer Vision (CV) is a field of Artificial Intelligence that enables computers to see, interpret,
and understand visual information from the world—just like humans do.
It focuses on processing images and videos to extract meaningful information and perform
actions based on that understanding.
🌟 Why Computer Vision Matters
Computer Vision powers many of the technologies you use every day:
📱 Face unlock on smartphones
🚗 Self-driving cars detecting lanes and pedestrians
📷 Photo filters and AR effects
🛒 Product recognition in retail
🔍 Medical imaging (detecting tumors, analyzing X-rays)
🎮 Gesture recognition in gaming
🔍 Key Tasks in Computer Vision
1. Image Classification
Determines what is in an image.
Input: image of a cat
Output: "cat"
2. Object Detection
Identifies where objects are and what they are.
Draws bounding boxes around objects like cars, people, animals.
3. Image Segmentation
Breaks an image into pixel-level regions.
Semantic Segmentation: Labels each pixel by class.
Instance Segmentation: Separates individual objects.
4. Face Recognition
Matching or verifying identities from images of faces.
5. Optical Character Recognition (OCR)
Extracts text from images:
Reading license plates
Scanning documents
Translating text from photos
6. Image Generation
Creating new images using models like GANs or diffusion models.
🧠 How Computer Vision Works
Modern CV uses Machine Learning and especially Deep Learning (neural networks).
The most common architecture is the Convolutional Neural Network (CNN).
Simplified workflow:
1. Data Collection — Gather images.
2. Preprocessing — Resize, normalize, augment.
3. Model Training — Teach the network patterns.
4. Prediction — Model analyzes new images.
5. Evaluation & Improvement — Optimize for better accuracy.
Popular Tools & Libraries
Python Libraries
OpenCV – Basic image processing
TensorFlow / Keras – Deep learning models
PyTorch – Most common for CV research
MediaPipe – Hands, face, pose detection
scikit-image – Image transformations
🧪 Common Image Processing Techniques
Grayscale conversion
Blurring, sharpening
Edge detection (Canny, Sobel)
Thresholding
Morphology (dilation, erosion)
Histogram equalization
These are usually used before feeding images into ML models.
📌 Applications of Computer Vision
Computer Vision is widely used across many industries to help machines interpret visual
information. Key applications include:
Image Classification – Identifying objects or scenes in images (e.g., detecting cats, cars,
diseases).
Object Detection – Locating and classifying multiple objects in real time, used in
surveillance and traffic monitoring.
Facial Recognition – Used for authentication, security, and social media tagging.
Medical Imaging – Assisting doctors by analyzing X-rays, MRIs, and CT scans to spot
abnormalities.
Autonomous Vehicles – Detecting lanes, pedestrians, traffic signs, and obstacles for safe
navigation.
Industrial Automation – Quality inspection, defect detection, and robotic guidance in
manufacturing.
Retail & E-commerce – Product recognition, cashier-less checkout, and visual search.
Agriculture – Monitoring crop health and detecting pests using drone imagery.
Augmented & Virtual Reality (AR/VR) – Hand tracking, pose estimation, and
environment mapping.
OCR (Optical Character Recognition) – Converting text from images for document
scanning and translation.
Computer Vision helps automate tasks, improve accuracy, and enhance decision-making across
multiple domains.
📌 Image Classification
Image Classification is a fundamental task in computer vision where a computer model analyzes
an image and assigns it a label based on its content. The goal is to determine what object or
category is present in the image.
Key points:
It uses machine learning, especially deep learning techniques like Convolutional Neural
Networks (CNNs).
The model is trained on a large set of labeled images to learn patterns, shapes, colors,
and textures.
During prediction, the trained model compares a new image with learned features and
outputs the most likely class.
Common applications include identifying animals, detecting diseases in medical images,
sorting products, and scene recognition.
📌 Object Detection
Object Detection is a computer vision technique used to identify what objects are present in an
image and where they are located. Unlike image classification, it provides both the class label
and the bounding box around each object.
Key points:
Uses deep learning models like YOLO, SSD, and Faster R-CNN.
Combines classification (what the object is) and localization (where it is).
Useful for real-time applications such as surveillance, autonomous vehicles, traffic
monitoring, and robotics.
🧪 Hands-on Activity: Image Classification using Teachable Machine
Objective:
To build and test a simple computer vision model that can classify images using Google's
Teachable Machine—no coding required.
🔧 Materials Needed
A laptop / mobile with camera
Internet connection
Access to Teachable Machine ([Link]
📌 Steps
1. Open Teachable Machine
Go to the website and select "Image Project" → "Standard Image Model".
2. Create Classes
Create at least two classes (e.g., Class 1: Smile, Class 2: No Smile or Class 1: Book, Class 2: Pen).
3. Collect Images
Use your webcam or upload images:
Capture 20–30 images for each class
Use different angles, lighting, etc., for better accuracy
4. Train the Model
Click “Train Model”.
Wait a few seconds—it will build a small image classifier.
5. Test Your Model
Use the webcam to check how well the model recognizes each class.
Try showing objects or gestures to see the prediction confidence.
6. Export / Use the Model (Optional)
Teachable Machine allows you to:
Download the model
Use it in websites, apps, or Python code
📘 Expected Learning Outcomes
Students will learn:
How image classification works
How to prepare datasets
How training and testing a CV model is done
How CV tools make predictions in real time