Affiliated to CBSE New Delhi
Address:
Near Gandhi Institute, Opp. Jainpur, Hapur Bypass, Meerut
PRACTICAL FILE
Artificial Intelligence
Session- 2024-25
SUBMITTED TO: SUBMITTED BY:
Mr. Ravindra Kumar NAME:
CLASS:
ROLL NO:
ACKNOWLEDGEMENT
I wish to express my deep sense of
gratitude and indebtedness to our learned teacher
TEACHER’S NAME , DESIGNATION, [SCHOOL
NAME] for his invaluable help, advice and
guidancein the preparation of this project.
I am also greatly indebted to our principal
[Name of principal] and school authorities for
providing me with the facilities and requisite
laboratory conditions for making this practical file.
I also extend my thanks to a number of
teachers, my classmates and friends who helped me
to complete this practical file successfully.
[Name of Student]
CERTIFICATE
This is to certify that [Name of Student],
student of Class X, [NAME OF SCHOOL] has
completed the PRACTICAL FILE during the academic
year [SESSION] towards partial fulfillment of credit
for the ARTIFICIAL INTELLIGENCE practical
evaluation of 2024-25 and submitted satisfactory
report, as compiled in the following pages, under my
supervision.
Total number of practical certified are : .
ExaminerSignature
Date: School Seal Principal Signature
Index
S.No. Practical Date Signature
Unit 3 Advanced Python
1. Write a program to make basic Calculator.
a=float(input("Enter first number="))
b=float(input("Enter Second number="))
print'Press 1 for Addition='
print'Press 2 for Subtraction='
print'Press 3 for Multiplication='
print'Press 4 for Division='
c=input()
if c==1:
d=a+b
elif c==2:
d=a-b
elif c==3:
d=a*b
elif c==4:
d=a/b
print("Result=",d)
2. Write a Program to compare the entered three numbers.
a=float(input())
b=float(input())
c=float(input())
if((a>b and a>c) and (a!=b and a!=c)):
print a,' is the largest number'
elif((b>a and b>c) and (b!=a and b!=c)):
print b,' is the largest number'
elif((c>a and c>b) and (c!=a and c!=b)):
print c,' is the largest number'
else:
print 'Entered numbers are equal'
3. Write a program to compute the Percentage and Division of Student marks.
print'Enter Students Marks subject wise'
hindi=int(input("Hindi="))
english=int(input("English="))
maths=int(input("Maths="))
science=int(input("Science="))
sst=int(input("S.St="))
ai=int(input("AI="))
total=hindi+english+maths+science+sst+ai
per=total/6
print'Total=',total
print'Percentage=',per,'%'
if(per>60 and per<100):
print'Division=First'
elif(per>45 and per<60):
print'Division=Second'
elif(per>33 and per<45):
print'Division=Third'
elif(per>0 and per<33):
print'Fail'
else:
print 'Invalid Entry'
4. Write a program to check if given password is correct or not.
print'Enter any password'
password=int(input())
if password== 45621:
print'this is first password and it is correct password to login'
elif password==52145:
print'this is second password and it is correct password to login'
else:
print'Incorrect Password'
5. Write a Python program to calculate the profit gained o loss incurred, taking the
cost price and selling price as the inputs from the user.
costprice=float(input('Enter Cost Price of Product (in Rs.):'))
sellprice=float(input('Enter Selling Price of Product (in Rs.)'))
result=float()
if costprice>sellprice:
result=costprice-sellprice
print'Rs.:',result,'Loss'
elif costprice<sellprice:
result=sellprice-costprice
print'Rs.:',result,'Profit'
elif costprice==sellprice:
result=costprice-sellprice
print'Rs.:',result,'No profit no loss'
else:
print'Incorrect number'
6. Write a Python program that accepts a number and then prints a table for that
number.
a=float(input("Enter any number:"))
b=a*1
print(str(a)+"x1="+str(b))
b=a*2
print(str(a)+"x2="+str(b))
b=a*3
print(str(a)+"x3="+str(b))
b=a*4
print(str(a)+"x4="+str(b))
b=a*5
print(str(a)+"x5="+str(b))
b=a*6
print(str(a)+"x6="+str(b))
b=a*7
print(str(a)+"x7="+str(b))
b=a*8
print(str(a)+"x8="+str(b))
b=a*9
print(str(a)+"x9="+str(b))
b=a*10
print(str(a)+"x10="+str(b))
7. Write a Python program using for loop to print numbers till given range.
a=int(input("Enter any number"))
for a in range(a):
print(a)
else:
print"Task Complete"
8. Write a program to calculate the sum of natural numbers up to n.
n=int(input("Enter number:"))
if n<0:
print("Enter a positive number")
else:
sum=0
while(n>0):
sum +=n
n-=1
print'The sum of :',sum
9. Write a Python program to check given year is leap year or not.
year=int(input("Enter any Year: "))
if(year%4)==0:
if(year%100)==0:
if(year%400)==0:
print year, ‘is leap year'
else:
print year, ‘is not a leap year'
else:
print year, ‘is a leap year'
else:
print year, ‘is not a leap year'
10. Write a Python program to convert temperature Fahrenheit to
Celsius.
fah=float(input("Enter Temperature in Fahrenheit="))
cel=(fah-32)/1.8
print ‘Temperature in Celsius=',cel, 'C'
11. Write a Python program to check given number is positive or
negative.
a=int(input("Enter any Positive or Negative number="))
if a>0:
print'This is Positive Number'
elif a<0:
print'This is Negative Number'
elif a==0:
print'This is zero value'
else:
print'Incorrect Value'
12. Write a Python program to reversing the order of entered numbers
of a list.
i=int(input("Enter any number="))
a=[]
while i>0:
print'Enter Number='
num=input()
a.append(num)
i=i-1
print(a)
a.reverse()
print(a)
13. Write a Python program to make a list of given integer inputs.
Store only even values given and print the list.
i=int(input("Enter any number="))
a=[ ]
while i>0:
print'Enter number='
num=int(input())
if num%2==0:
a.append(num)
i=i-1
print(a)
14. Write a Python program to addition of string and integer using
explicit conversion.
myint=562
mystr="430"
print(type(myint))
print(type(mystr))
newstr=int(mystr)
print(type(mystr))
mysum=myint+newstr
print(mysum)
print(type(mysum))
15. Write a Python program to check if a number is even or odd.
a=input("Enter a n;umber=")
if(a%2)==0:
print('Even Number')
else:
print('Odd Number')
Unit 4 Data Science
1. Write a program to create a 2D array using NumPy.
import numpy as np
# Create a 2D array with shape (3, 4)
arr = np.array([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]])
print(arr)
Output:
[[ 1 2 3 4]
[ 5 6 7 8]
[ 9 10 11 12]]
2. Create a 3x3 matrix with values ranging from 2 to 10.
import numpy as np
x = np.arange(2, 11).reshape(3,3)
print(x)
Output:
[[ 2 3 4]
[ 5 6 7]
[ 8 9 10]]