0% found this document useful (0 votes)
6 views19 pages

AI Record 2024

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views19 pages

AI Record 2024

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Kulapati Munshi Bhavan’s Vidya Mandir

Pottore,Thrissur–680581

ARTIFICIAL INTELLIGENCE
PRACTICAL & PROJECT RECORD
CLASS X
Certified that this is a Bonafide Record of the Practicals and Project
Work of Master/Kumari.......................................................................

Class..................... RegNo .................................Year 2024-’25.

Teacher-in-charge Principal
Date: .......................

1
INDEX
Sl No Date Title Page No.
1 04-06-2024 To concatenate two strings 3
To check whether a given number is odd
2 04-06-2024 4
or even
Menu driven program to perform the
3 11-06-2024 5
four basic arithmetic operations
4 11-06-2024 To print natural numbers up to n 6

5 18-06-2024 To print multiplication table of n 7


To check whether a given number is
6 09-07-2024 8
prime or not
7 27-08-2024 To add two lists(fruits and vegetables) 9
To calculate mean, median and mode
8 08-10-2024 10
using Numpy
9 15-10-2024 To display line chart from (2,5) to (9,10) 11
To display a scatter chart for the
10 22-10-2024 following points (2,5), 12
(9,10),(8,3),(5,7),(6,18)
To plot temperature against time using
11 29-10-2024 13
Line plots(dashed)
To read student.csv file saved in your
12 05-11-2024 14
system and display first 5 rows

To read student_performance.csv file


13 05-11-2024 saved in your system and display 15
information of first 10 rows

14 12-11-2024 To read and display an image 16


To read and display an image and identify
15 19-11-2024 17
its shape
To read an image and display it in
16 19-11-2024 18
grayscale
17 20-11-2024 Project Report 19

2
04-06-2024

#1.Program to concatenate(add) two strings(first name and second


name)

PROGRAM

fname=input("Enter your first name: ")


sname=input("Enter your second name: ")
fullname=fname+" "+sname
print("Your actual name is :", fullname)

OUTPUT
Enter your first name: Arjun
Enter your second name: Pandey
Your actual name is : Arjun Pandey

1
04-06-2024

#2.Program to check whether a number is odd or even

PROGRAM

n=int(input("Enter a number: "))


if n%2==0:
print(n,"is even")
else:
print(n, "is odd")

OUTPUT
Enter a number: 15
15 is odd

4
11-06-2024

#3. Menu driven program to perform the four basic arithmetic


operations

PROGRAM
print("1.Add")
print("2.Subtract")
print("3.Multiply")
print("4.Divide")
choice=int(input("Enter your choice(1-4): "))
if choice >=1 and choice <=4:
a=int(input("Enter a number: "))
b=int(input("Enter a number: "))
if choice==1:
s=a+b
print("sum =", s)
elif choice==2:
d=a-b
print("Difference =", d)
elif choice==3:
p=a*b
print("Product =", p)
elif choice == 4:
q=a/b
print("Quotient =", q)
else:
print("Invalid choice!")
OUTPUT
1.Add
2.Subtract
3.Multiply
4.Divide
Enter your choice(1-4): 1
Enter a number: 40
Enter a number: 50
sum = 90

5
11-06-2024

#4. Program to print natural numbers upto n

PROGRAM

n=int(input("Enter a number: "))


for i in range(1,n+1):
print(i)

OUTPUT
Enter a number: 10
1
2
3
4
5
6
7
8
9
10

6
18-06-2024

#5. Program to print multiplication table of n

PROGRAM

n=int(input("Enter a number: "))


i=1
while i<=10:
print(n,"x",i,"=",n*i)
i+=1

OUTPUT
Enter a number: 5
5x1=5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50

7
09-07-2024

#6. Program to check whether a given number is prime or not

PROGRAM

n=int(input("Enter a number: "))


c=0
for i in range(1,n+1):
if n%i==0:
c+=1
if c==2:
print(n,"is prime")
else:
print(n,"is not prime")

OUTPUT

Enter a number: 7
7 is prime

8
27-08-2024

#7. Program to add two lists(fruits and vegetables)

PROGRAM

fruits=["Apple", "Orange", "Banana", "Grapes"]


vegetables=["Carrot", "Cabbage", "Brinjal", "Tomato"]
mydiet=fruits+vegetables
print("My new diet is : ", mydiet)

OUTPUT

My new diet is : ['Apple', 'Orange', 'Banana', 'Grapes', 'Carrot',


'Cabbage', 'Brinjal', 'Tomato']

9
08-10-2024

#8. Write a program to calculate mean, median and mode using


Numpy

PROGRAM

Import numpy as np #importing numpy library to use numerical


#functions like mean() & median() and to refer it as np

import statistics as stat #importing statistics library to use the


#statistical function mode()

speed=[100,99,99,98,96,95,100,98,89,99,97,95,100,99,99,98]
#speed is a list to store the speed of vehicles

x=np.mean(speed)
y=np.median(speed)
z=stat.mode(speed)
print ("Mean =", x)
print("Median =", y)
print("Mode =", z)

OUTPUT
Mean = 97.5625
Median = 98.5
Mode = 99

10
15-10-2024

#9. Write a program to display line chart from (2,5) to (9,10).


PROGRAM
Import matplotlib.pyplot as plt #importing 2D plotting library and
#to refer it as plt
x=[2,9] #x axis values in a list

y=[5,10] #y axis values in a list

plt.plot(x,y) #plot() to plot the line graph

plt.xlabel("X Axis") #to give "X axis" as the label for X axis

plt.ylabel("Y Axis") #to give "Y axis" as the label for Y axis

plt.title("Simple line chart from (2,5) to (9,10)")


#to give the title for the graph

plt.show #to display the graph

OUTPUT

11
22-10-2024

#10. Write a program to display a scatter chart for the following


points (2,5), (9,10),(8,3),(5,7),(6,18).
PROGRAM

Import matplotlib.pyplot as plt


x=[2,9,8,5,6]
y=[5,10,3,7,18]
plt.scatter(x,y,c="red") #to plot a scatter chart with color as red

plt.title("Scatter chart for the points (2,5),(9,10),(8,3),(5,7),(6,18)")


plt.xlabel("X Axis")
plt.ylabel("Y Axis")
plt.show
OUTPUT

12
29-10-2024

#11. Write a program to plot temperature against time using Line


plots(dashed)
PROGRAM
Import matplotlib.pyplot as plt
Import numpy as np #importing numpy and referring it
#as np to use array

time=np.array([5,15,30,40]) #storing time as X axis values in an array

temperature=np.array([35,50,70,100]) #storing temperature as


#Y axis values in an array
plt.plot(time,temperature,linestyle='dashed',c="red")
plt.title("Dashed Line plot - Temperature against time")
plt.xlabel("Time in Minutes")
plt.ylabel("Temperature in Celsius")
plt.show
OUTPUT

13
#12. Write a program to read student.csv file saved in your system
and display first 5 rows

PROGRAM

import pandas as pd #importing pandas library to handle csv files


dataframe = pd.read_csv("c:/AI_10/student.csv")
#read_csv() to read csv file and to save it in dataframe

dataframe.head() #head() to display first 5 rows of csv file

OUTPUT

Rollno Name Mark

0 501 Ram Jith 99

1 502 Raghu Nath 94

2 503 Lal Krishna 96

3 504 Renu Roy 93

4 505 Mili Baby 80

14
05-11-2024

#13. Write a program to read student_performance.csv file saved in


your system and display information of first 10 rows

PROGRAM

import pandas as pd
dataframe = pd.read_csv("c:/AI_10/student_performance.csv")
dataframe.head(10) #head(10) to display first 5 rows of csv file

OUTPUT

15
12-11-2024

#14. Write a program to read and display an image using Python.

PROGRAM

import cv2 #importing cv2 library to handle images

import matplotlib.pyplot as plt


img = cv2.imread('c:/AI_10\original_man.jpg')
#imread() to read a image and to save it in img

plt.imshow(img) #imshow() to display the image

plt.title('Man', fontsize=20) #to display the title 'Man' with fontsize 20

plt.axis('off') #to hide the x and y axis values

plt.show()

OUTPUT

16
19-11-2024

#15. Write a program to read and display an image and identify its
shape using Python.
PROGRAM

import cv2
import matplotlib.pyplot as plt
img = cv2.imread('c:/AI_10\original_man.jpg')
plt.imshow(img)
plt.title('Man')
plt.axis('off')
plt.show()
print(img.shape) #to display the height, width and no of channels

OUTPUT

17
#16. Write a program to read an image and display it in grayscale.

PROGRAM

import cv2
import matplotlib.pyplot as plt
img = cv2.imread('c:/AI_10\original_man.jpg',0)
#to read the image in grayscale

plt.imshow(img, cmap='gray') #cmap set to 'gray' to display the


#image in grayscale

plt.title('Man')
plt.axis('off')
plt.show()
OUTPUT

18
ARTIFICIAL
INTELLIGENCE

PROJECT REPORT 2024-‘25

19

You might also like