Artificial
Intelligence Lab
Record
Mir Azmat Ali
10-M
044439
SHARJAH INDIAN SCHOOL
JUWAIZA
Certificate
This is to certify that Master Mir Azmat Ali
of Grade X-M has successfully completed his Practical Work in
Subject Code : 417 Subject: Artificial Intelligence
as prescribed by the Central Board of Secondary Education, New
Delhi during the academic year 2024-2025.
RANI LAL
Teacher in Charge
Date:
15/11/2024
1 | Page
INDEX
No: Date Practical Pg No
1 15/05/2024 IF FUNCTION 3
2 22/05/2024 STRING METHODIF ELIF 4
FOR/WHILE LOOP-MULTIPLICATION
3. 06/06/2024 5
TABLE
4. 20/06/2024 WHILE LOOP-MENU BASED 6
5. 14/09/2024 LIST 8
6. 21/09/2024 DATA SCIENCE-1 9
7. 26/09/2024 DATA SCIENCE-2 10
8. 02/10/2024 COMPUTER VISION-1 12
9. 26/10/2024 COMPUTER VISION-2 13
10. 14/11/2024 COMPUTER VISION-3 14
2 | Page
Record File 1
Objective: Develop a program to find the result of students based on the
marks given by the user
Concepts Used: Input function, print function, int function, if function
Source Code:
mark=int(input('Enter mark:' ))
if mark>=50 :
print("Congratulations, you passed the exam")
Output:
3 | Page
Record File 2
Objective: Write a program to check whether the given character is an uppercase
letter or lowercase letter or a digit or a special character.
Concepts Used: if function, isupper ( ), islower ( ), isdigit ( ), isspace ( )
Source Code:
#Input the character to check
ch=input("Enter Any Character:")
'''Checking whether it is uppercase or
lowercase or digit or a special character'''
if [Link]():
print(ch, " is an upper case letter")
elif [Link]():
print(ch, " is a lower case letter")
elif [Link]():
print(ch, " is a digit")
elif [Link]():
print(ch, " is a space")
else:
print(ch," is a special character")
Output:
4 | Page
Record File 3
Objective: Write a program to print a multiplication table of the entered
number
Concepts Used: Input function, print function, for loop/While loop
Source Code:
#Take input to accept a number for printing Multiplication table
n=int(input("Enter number to print multiplication table:"))
for i in range(1,11):
print(n," x ", i, " = ", n*i )
Output:
5 | Page
Record File 4
Objective: To create a menu-based program to perform the following task
AREA OF CIRCLE
AREA OF RECTANGLE
CIRCUMFERENCE OF CIRCLE
AREA OF SQUARE
Concepts Used: Variables, Input Function, Print Function, if-elif-else, While Loop
Source Code:
while True:
print("[Link] AREA OF CIRCLE")
print("[Link] AREA OF RECTANGLE")
print("[Link] CIRCUMFERENCE OF CIRCLE")
print("[Link] AREA OF SQUARE")
ch=int(input("ENTER YOUR CHOICE(ENTER 0 TO EXIT):"))
if ch==1:
r=int(input("ENTER RADIUS OF CIRCLE-"))
a=3.14*r*r
print("AREA OF CIRCLE IS-",a)
elif ch==2:
l=int(input("ENTER LENGTH OF RECTANGLE-"))
b=int(input("ENTER BREADTH OF RECTANGLE-
"))
a=l*b
print("AREA OF RECTANGLE IS-",a)
elif ch==3:
r=int(input("ENTER RADIUS OF CIRCLE-"))
c=2*3.14*r
print("CIRCUMFERENCE OF CIRCLE IS-",c)
elif ch==4:
l=int(input("ENTER LENGTH OF SQUARE-"))
a=l*l
print("AREA OF SQUARE IS",a)
elif ch==0:
break
else:
print("INVALID INPUT")
Output:
6 | Page
7 | Page
Record File 5
—-----------------------------------------------------------------------------------------------------
Objective:
Write a program to create a list of students' marks with user-defined values and
find the maximum.
Concepts Used: Input function, print function, int function, if function
Source Code:
#Take input for n lines
n=int(input("Enter no. of subjects:"))
#Creating empty list
l=[]
#Accepting marks and appending marks into the list
for i in range(n):
m=int(input("Enter marks:"))
[Link](m)
print("Maximum marks scored:",max(l)
Output:
8 | Page
Record File 6
Objective: Write a program to create a 2D array using NumPy.
Concepts Used: numpy,[Link](),[Link]
Source Code:
#import numpy package
import numpy as np
#Creating array using arange() function
arr=[Link](5,45,5)
#reshaping array for 2D
arr=[Link](2,4)
#printing array
print(arr)
Output:
9 | Page
Record File 7
Objective: Observe the given data for monthly sales of one of the salesmen for 6
months. Plot them on the line chart.
Apply the following customizations to the chart:
▪ Give the title for the chart - "Sales Stats"
▪ Use the "Month" label for X-Axis and "Sales" for Y-Axis.
▪ Display legends.
▪ Use dashed lines with the width 5 point.
▪ Use red color for the line.
▪ Use dot marker with blue edge color and black fill color.
Concepts Used: [Link]
Source Code:
#Import pyplot
import [Link] as pp
#Prepraing data
mon =['January','February','March','April','May','June']
sales = [2500,2100,1700,3500,3000,3800]
#Crating line chart
10 | Page
[Link](mon,sales,label='Sales',color='r',linestyle='dashed', linewidth=4,\
marker='o', markerfacecolor='k', markeredgecolor='b')
#Customizing the chart
[Link]("Sales Report")
[Link]("Months")
[Link]("Sales")
[Link]()
[Link]()
Output:
11 | Page
Record File 8
isit this link ([Link] On the basis of this
V
online tool, try and write answers of all the below-mentioned questions.
a. What is the output colour when you put R=G=B=255?
b. What is the output colour when you put R=G=255,B=0?
c. What is the output colour when you put R=255,G=0,B=255?
d. What is the output colour when you put R=0,G=255,B=255?
e. What is the output colour when you put R=G=B=0?
f. What is the output colour when you Put R=0,G=0,B=255?
g. What is the output colour when you Put R=255,G=0,B=0?
h. What is the output colour when you put R=0,G=255,B=0?
Output:
a. White
b. Yellow
c. Magenta
d. Cyan
e. Black
f. Blue
g. Red
h. Green
12 | Page
Record File 9
Objective:Load Image and Give the title of image
Concepts Used: cv2,matplotlib,numpy,imread(),imshow()
Source Code:
#import required module cv2, matplotlib and numpy
import cv2
import [Link] as plt
import numpy as np
#Load the image file into memory
img = [Link]('[Link]')
#Display Image
[Link](img)
[Link]('Octopus')
[Link]('off')
[Link]()
Output:
13 | Page
Record File 10
—-----------------------------------------------------------------------------------------------------------------------------------------
Objective: Change the colour of image and Change the image to grayscale
Concepts Used: cv2,matplotlib,numpy,imread(),imshow()
Source Code:
#import required module cv2, matplotlib and numpy
import cv2
import [Link] as plt
import numpy as np
#Load the image file into memory
img = [Link]('[Link]')
#Chaning image colour image colour
[Link]([Link](img, cv2.COLOR_BGR2RGB))
[Link]('Octopus')
[Link]('off')
[Link]()
Output:
14 | Page