Class 10 - Ai Practical File
Class 10 - Ai Practical File
INDEX
Sr.no Topic Date sign
1 To calculate area and perimeter of rectangle
2 To find greater of two numbers
3 Accept marks in 3 subjects, Calculate Total,
Average and display Grade
4 Accept cost price, selling price and display
the profit or loss incurred
5 Display odd numbers till 30 using while loop
6 program to print numbers till which the user
wants using while loop
7 Create a list having names of 5 flowers and
5 numbers and display the elements using
for loop
8 Adding odd and even numbers into list using
loops
9 Write a program to print a multiplication
table of the entered number using for loop.
10 Display consecutive numbers from 25 to 40
in ascending order using for loop
11 Analyse data and plot the data on the line
chart
12 plot data on bar chart
13 plot data on pie chart
14 To calculate mean, median, mode
15 Display image using computer vision
16 Display image in Gray Scale
Unit 3-Advanced python
1. To calculate area and perimeter of rectangle
# program to calculate area and perimeter of rectangle
if(n1>n2):
print("The first number",n1,"is greater")
elif(n2>n1):
print("The second number",n2,"is greater")
else:
print("both numbers are equal")
3. Accept marks in 3 subjects, Calculate Total, Average and display Grade
#program to check grades using elif
sci = float(input("Enter science marks : "))
eng = float(input("Enter english marks : "))
ss = float(input("Enter social science marks : "))
total = sci + eng + ss
print ("The total marks are ", total)
percent = total/300 * 100
print ("Your percentage is ", percent)
if (percent >= 75) :
print ("Grade is Distinction.")
elif (percent >= 60) :
print ("Grade is First Class.")
elif (percent >= 45) :
print ("Grade is Second Class.")
elif (percent >= 33) :
print ("Grade is Pass.")
else :
print ("You have Failed.")
4. Accept cost price, selling price and display the profit or loss incurred
# program to print profit or loss
sp = float(input("Enter selling price : "))
cp = float(input("Enter Cost price : "))
if (sp>cp) :
p=sp-cp
print ("You have made a profit of",p,"rupees")
elif (cp>sp) :
l=cp-sp
print("You have made a loss",l,"rupees")
else :
print ("You have made no profit or loss ")
Computer vision
15. Display image using computer vision
#program to display image
import cv2
img=cv2.imread(r"C:\Users\LAB-4-SMV-84\Desktop\pic1.jpg",1)
cv2.imshow("original",img)
cv2.waitKey()
OR
#program to display image using matplotlib
import cv2
import matplotlib.pyplot as plt
img=cv2.imread(r"C:\Users\Desktop\pic1.jpg")
plt.title("flowers")
plt.imshow(img)