X AI Record
X AI Record
ARTIFICIAL INTELLIGENCE
Class : X
BONAFIDE CERTIFICATE
Certificate to be the bonafide record of Artificial Intelligence project work done
on ……………..………… by …….………………………………………………… of
class X at Advaith International Academy, during the academic year
2024-2025.
Staff-in-Charge
I take this opportunity to express my gratitude to the people who have been Instrumental in the
successful completion of this project. I express my heartfelt gratitude to my parents for
constant en co u rage m en t while ca rrying out this project. I gratefully acknowledge the
contribution of the individuals who contributed towards this project’s completion, and continues
to look after me despite my flaws.
I wish to express my deep gratitude and sincere thanks to our Principal Ms. Sangeeta Roy
for her encouragement and provided facilities for this school project. I sincerely appreciate her
generosity by taking me into this fold which I shall remain indebted to her.
My sincere thanks to Mr. Nagaraj K a guide and mentor who critically reviewed my project and
helped in solving each and every problem, occurred during implementation of the project.
I offer my sincere thanks to my classmates who haloed me to carry out this project successfully.
I would like to thank CBSE board for providing this golden opportunity to investigate on this
topic and to know many things.
INDEX
Sl Name of the Program Pg Sign
No. No.
1 Write a python program to check whether the given number is prime or not?
3 Write a python program to generate Calendar for the given month and year?
Data Science
5 Write a program to import data from a CSV file into a pandas program.
11 Write a program to read and display image using the opencv cv2 library.
12 Write a program to read and display original image using the opencv cv2 library.
13 Write a program to read and display gray color image using the opencv cv2 library.
Source Code:
# Take input from the user
num = int(input("Enter a number: "))
Output:
Enter a number: 6
6 is not a prime number
Result: Thus, the program to to check whether the given number is prime or not has been
created and executed successfully.
Program 2:
Write a python program to implement a simple Chatbot?
Source Code:
print("Simple Question and Answering Program")
print("=======================================")
print("You may ask any one of these questions:")
print("Hi")
print("How are you?")
print("Are you working?")
print("What is your name?")
print("What did you do yesterday?")
print("Quit")
while True:
question = input("Enter one question from above list: ").lower()
# Convert input to lowercase to handle case sensitivity
if question == 'hi':
print("Hello")
elif question in ['are you working?', 'are you doing any job?']:
print("Yes, I am working in SCMVBM School")
Result: Thus, the program to implement simple Chatbot? has been created and
executed successfully.
Program 3: Write a python program to generate Calendar for the given month and year?
Source Code:
import calendar
yy = int(input("Enter year: "))
mm = int(input("Enter month: "))
print(calendar.month(yy, mm))
Output:
Enter year: 2010
Enter month: 5
Result: Thus, the program to implement simple Chatbot? has been created and
executed successfully
Program 4: Write a python program to implement a Simple Calculator program?
Source Code: def add(x, y): return x + y def subtract(x, y): return x - y
def multiply(x, y):
return x * y def
divide(x, y):
return x / y
print("Select
operation.")
print("1.Add")
print("2.Subtract
")
print("3.Multiply"
) print("4.Divide")
choice = input("Enter choice(1/2/3/4):")
num1 = int(input("Enter first number: ")) num2 =
int(input("Enter second number: ")) if choice ==
'1': print(num1,"+",num2,"=",
add(num1,num2))
elif choice == '2': print(num1,"-",num2,"=",
subtract(num1,num2))
elif choice == '3': print(num1,"*",num2,"=",
multiply(num1,num2))
elif choice == '4':
print(num1,"/",num2,"=", divide(num1,num2))
else:
print("Invalid input")
Output:
Result:
Thus, the program to implement simple Chatbot? has been created and executed successfully
Data Science
Program 5: Write a program to import data from a CSV file into a pandas program.
Id, name, salary, start_date, dept
1 Rick 623.3 2012-01-01 IT
2 Dan 515.2 2013-09-23 Operations
3 Tusar 611 2014-11-15 IT
4 Ryan 729 2014-05-11 HR
5 Gary 843.25 2015-03-27 Finance
6 Rasmi 578 2013-05-21 IT
7 Pranab 632.8 2013-07-30 Operations
● Reading a CSV File
The read_csv function of the pandas library is used to read the content of a CSV file into the python
environment as a pandas DataFrame. The function can read the files from the OS by using the proper
path to the file.
Source Code:
import pandas as pd
df = pd.read_csv('path\filename.csv')
print (df)
Output
id name salary start_date dept
1 Rick 623.3 2012-01-01 IT
2 Dan 515.2 2013-09-23 Operations
3 Tusar 611 2014-11-15 IT
4 Ryan 729 2014-05-11 HR
5 Gary 843.25 2015-03-27 Finance
6 Rasmi 578 2013-05-21 IT
7 Pranab 632.8 2013-07-30 Operations
Bar Graph
Histogram
Program 9: Write a program to draw pie charts using matplotlib library
With Pyplot, you can use the pie() function to draw pie charts:
Syntax:
import matplotlib.pyplot as plt import numpy as np y = np.array([35, 25, 25, 15])
plt.pie(y) plt.show()
Program 10:
With Pyplot, you can use the scatter() function to draw a scatter plot. The scatter() function plots one dot for
each observation. It needs two arrays of the same length, one for the values of the x-axis, and one for values
on the y-axis:
Syntax:
import matplotlib.pyplot as plt import numpy as np
x = np.array([5,7,8,7,2,17,2,9,4,11,12,9,6])
y = np.array([99,86,87,88,111,86,103,87,94,78,77,85,86])
plt.scatter(x, y) plt.show()
Computer Vision (OpenCV)
Note: Before going to execute computer vision examples we need to execute opencv library command. i.e.
‘pip install opencv-python’. Afterwards in the new cell you can write the program to execute.
Program 11: Write a program to read and display images using the opencv cv2 library.
Source Code: import cv2
import matplotlib.pyplot as plt img = cv2.imread('E:\SVIS_Logo.jpg')
#Load the image file into memory plt.imshow(img)
plt.title('School')
plt.axis('off')
plt.show( )
Note: BGR stands for Blue (255, 0, 0), Green (0, 255, 0), Red (0, 0, 255). OpenCV uses BGR color as a
default color space to display images, when we open an image in openCV using cv2. imread( ) it
display the image in BGR format. And it provides color-changing methods using cv2.
Output:
Program 12: Write a program to read and display original images using opencv cv2 library.
Source Code: import cv2
import matplotlib.pyplot as plt img = cv2.imread('E:\SVIS_Logo.jpg')
#Load the image file into memory plt.imshow(cv2.cvtColor(img,
cv2.COLOR_BGR2RGB)) plt.title('School')
plt.axis('off')
plt.show( )
Source Code:
import cv2
import matplotlib.pyplot as plt img =
cv2.imread('E:\SVIS_Logo.jpg',0)
# the number zero opens the image as a grayscale image
plt.imshow(img, cmap = 'gray', interpolation = 'bicubic')
#cmap specifies color mapping, gray in this case.
plt.title('School')
plt.axis('off')
plt.show( )
Output:Gray in color
Program 14: Write a program to crop the image using opencv cv2 library.
Source Code: import cv2
import matplotlib.pyplot as plt roi =
img[0:100,80:180] #img[range of y, range of x]
plt.imshow(cv2.cvtColor(roi, cv2.COLOR_BGR2RGB))
plt.title('School')
plt.axis('off')
plt.show( )
Output: Crop the image
Program 15: Write a program to resize the image using opencv cv2 library.
Source Code:
import cv2
import matplotlib.pyplot as plt img =
cv2.imread('E:\SVIS_Logo.jpg') resized = cv2.resize(img,
(400, 250)) plt.imshow(cv2.cvtColor(resized,
cv2.COLOR_BGR2RGB)) plt.title('School') plt.axis('on')
print(resized.shape) plt.show( )
Output: To resize the image