DASS & BROWN WORLD SCHOOL
PRACTICAL FILE
OF
ARTIFICIAL INTELLIGENCE (417)
CLASS: X
(Session: 2024-2025)
SUBMITTED TO: SUBMITTED BY:-
Student Name:
Class:
Roll No:
CERTIFICATE
This is to certify that ___________________________(Name of
Student with class) , student of Dass and Brown World School , Ferozepur
has completed this project under my guidance .The student has taken proper
care and shown utmost sincerity in completion of this project.
I certify that project is up to my expectation and as per the guidelines of
CBSE.
Signature of Examiner
TABLE OF CONTENTS
S.NO PROGRAM
1 Write a python program to find sum of two numbers.
2 Write a python program to display the square of first 3 natural numbers.
3 Write a python program to check whether a number is even or odd.
4 Write a python program to find out 2 raised to power x where x is taken as input.
5 Write a program to plot a bar chart in python to display the result of a school for five
consecutive years.
6 Create multiline chart on common plot where three data range plotted on
same chart. The data range(s) to be plotted are.
data=[[5,25,45,20],[8,1,29,27],[9,29,27,39]]
7 A survey gathers heights and weight of 50 participates and recorded the participants
age as
Ages=[40,56,46,58,79,70,67,46,32,91,92,93,47,95,69,69,56,50,30,9,29,29,0,31,21,14,1
8,1
6,18,76,68,69,78,81,71,91,71,01,69,78,77,54,59,59,41,51,48,49,76,10]
8. Draw a Square using turtle in python
9. Write a program to determine the type of an object.
10 Design a simple calculator using if elif in python
1. Write a python program to find sum of two numbers.
2. Write a python program to display the square of first 3 natural numbers.
3. Write a python program to check whether a number is even or odd.
4. Write a python program to find out 2 raised to power x where x is taken as input.
5. Write a program to plot a bar chart in python to display the result of a school for five
consecutive years.
import matplotlib.pyplot as pl
year=['2015','2016','2017','2018','2019'] # list of years
p=[98.50,70.25,55.20,90.5,61.50] #list of pass
j=['b','g','r','m','c'] # color code of bar charts
pl.bar(year, p, width=0.2, color=j) # bar( ) function to create the
pl.xlabel("year") # label for x-axis
pl.ylabel("Pass%") # label for y-axis
pl.show( ) # function to display bar chart
OUTPUT --
6. Create multiline chart on common plot where three data range plotted on
same chart. The data range(s) to be ploted are.
data=[[5,25,45,20],[8,1,29,27],[9,29,27,39]]
import numpy as np
import matplotlib.pyplot as plt
data=[[5,25,45,20],[8,1,29,27],[9,29,27,39]]
x=np.arange(4)
plt.plot(x,data[0],color='b',label='range 1')
plt.plot(x,data[1],color='g',label='range 2')
plt.plot(x,data[2],color='r',label='range 3')
plt.legend(loc='upper left')
plt.title('Multi range line chart')
plt.xlabel('X')
plt.xlabel('Y')
plt.show()
OUTPUT --
7. A survey gathers heights and weight of 50 participates and recorded the participants age
as
Ages=[40,56,46,58,79,70,67,46,32,91,92,93,47,95,69,69,56,50,30,9,29,29,0,31,21,14,18,1
6,18,76,68,69,78,81,71,91,71,01,69,78,77,54,59,59,41,51,48,49,76,10]
import numpy as np
import matplotlib.pyplot as plt
Ages=[40,56,46,58,79,70,67,46,32,91,92,93,47,95,69,69,56,50,30,90,29,29,\
45,31,21,14,18,16,18,76,68,69,78,81,71,91,71,30,69,78,77,\
54,59,59,41,51,48,49,76,10]
plt.hist(Ages,bins=10)
plt.title('Participates Ages Histogram')
plt.show()
OUTPUT --
8. Draw a Square using turtle in python
9. Write a program to determine the type of an object.
# Python code to determine the type of objects
# declaring objects and assigning values
a = 10
b = 10.23
c = "Hello"
d = (10, 20, 30, 40)
e = [10, 20, 30, 40]
# printing types of the objects
# using type() function
print("type(a): ", type(a))
print("type(b): ", type(b))
print("type(c): ", type(c))
print("type(d): ", type(d))
print("type(e): ", type(e))
Output
type(a): <class 'int'>
type(b): <class 'float'>
type(c): <class 'str'>
type(d): <class 'tuple'>
type(e): <class 'list'>
10. Design a simple calculator using if elif in python
Program:
print("Calculator")
print("1.Add")
print("2.Substract")
print("3.Multiply")
print("4.Divide")
# input choice
ch=int(input("Enter Choice(1-4): "))
if ch==1:
a=int(input("Enter A:"))
b=int(input("Enter B:"))
c=a+b
print("Sum = ",c)
elif ch==2:
a=int(input("Enter A:"))
b=int(input("Enter B:"))
c=a-b
print("Difference = ",c)
elif ch==3:
a=int(input("Enter A:"))
b=int(input("Enter B:"))
c=a*b
print("Product = ",c)
elif ch==4:
a=int(input("Enter A:"))
b=int(input("Enter B:"))
c=a/b
print("Quotient = ",c)
else:
print("Invalid Choice")
OUTPUT
Calculator
1.Add
2.Substract
3.Multiply
4.Divide
Enter Choice(1-4): 3
Enter A:10
Enter B:20
Product = 200