0% found this document useful (0 votes)
31 views

X AI Record

This is an practicals notes Ai

Uploaded by

Gowthami P
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)
31 views

X AI Record

This is an practicals notes Ai

Uploaded by

Gowthami P
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/ 16

ADVAITH INTERNATIONAL ACADEMY

CBSE Affil. 1930740 Nallur, Hosur School Code: 55695

ARTIFICIAL INTELLIGENCE

Sub Code: 417

PROJECT REPORT FILE


Academic Year: 2024 - 25

Student’s Name : …………………………………

Class : X

Roll Number : …………………………………


ADVAITH INTERNATIONAL ACADEMY
CBSE Affil. 1930740 Nallur, Hosur School Code: 55695

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

Student’s Name : …………………………………….


Roll Number : …………………………………….
Examination Center : ADVAITH INTERNATIONAL ACADEMY
Code : 55695
Exam Date : / / 2025

Internal Examiner Principal External Examiner


ACKNOWLEDGEMENT

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?

2 Write a python program to implement a simple Chatbot?

3 Write a python program to generate Calendar for the given month and year?

4 Write a python program to implement a Simple Calculator program?

Data Science

5 Write a program to import data from a CSV file into a pandas program.

6 Write a program to draw line plots using matplotlib library.

7 Write a program to draw bar charts using matplotlib library.

8 Write a program to draw histogram charts using matplotlib library.

9 Write a program to draw pie charts using matplotlib library.

10 Write a program to draw scatters charts using matplotlib library

Computer Vision (Open CV)

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.

14 Write a program to crop the image using opencv cv2 library.

Write a program to resize the image using opencv cv2 library.


15
Program 1:
Write a python program to check whether the given number is prime or not.

Source Code:
# Take input from the user
num = int(input("Enter a number: "))

# Prime numbers are greater than 1


if num > 1:
# Check for factors from 2 to num-1
for i in range(2, num):
if num % i == 0:
print(num, "is not a prime number")
break
else:
print(num, "is a prime number")
else:
print(num, "is not a prime 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 ['how are you?', 'how do you do?']:


print("I am fine")

elif question in ['are you working?', 'are you doing any job?']:
print("Yes, I am working in SCMVBM School")

elif question == 'what is your name?':


print("My name is Ira")
name = input("Enter your name: ")
print("Nice name, and nice meeting you, " + name)

elif question == 'what did you do yesterday?':


print("I saw 3 Idiots 5 times")

elif question == 'quit':


print("Goodbye!")
break # Exit the loop when 'quit' is entered
else:
print("I don't understand what you said")
Output:

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

Program 6: Write a program to draw line plots using matplotlib library.


import matplotlib.pyplot as plt
import numpy as np
x=np.array([2,3,5,6])
y=np.array([3,5,2,7])
plt.plot(x,y, marker='o', color='green')
plt.show()
Program 7: Write a program to draw histogram charts
using matplotlib library.
With Pyplot, you can use the bar() function to draw bar
graphs:
Syntax:
import matplotlib.pyplot as plt
import numpy as np
x = np.array(["A", "B", "C", "D"]) y =
np.array([3, 8, 1, 10])
plt.bar(x,y) plt.show()

To change the color of graph :


import matplotlib.pyplot as plt
import numpy as np x =
np.array(["A", "B", "C", "D"]) y =
np.array([3, 8, 1, 10])
plt.bar(x,y,color=['green','red','blue','viole)
plt.show()

Bar Graph

Program 8: Write a program to draw histogram charts using matplotlib library


Syntax:
import numpy as np x = np.random.normal(170, 10, 250) plt.hist(x) plt.show(x)

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( )

Output: Original Shade


Program 13: Write a program to read and display gray color images using the opencv cv2 library.

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

You might also like