NAME: Shalvi Bharti
CLASS & SEC. 9-A
ARTIFICIAL INTELLIGENCE
PRACTICAL FILE
2025-26
Name: Shalvi Bharti
Class & Sec.9-A
Roll No.37
Your Name/Class Sec AI/Practical File 1
CERTIFICATE
This is to certify that Shalvi Bharti of class 9-A ,
Rosary Sr. Sec. School, Delhi has successfully
completed this Python Practical File for the AISSCE
as prescribed by CBSE in the year 2025-2026.
Date : 18th August 2025
Signature
__________________
Your Name/Class Sec AI/Practical File 2
ACKNOWLEDGEMENT
I thank my Computer teacher Mr. Palvinder Singh for
guidance and support. I also thank my principal Rev.
Fr. Jose . I would also like to thank my parents for
encouraging me. Finally I would like to thank CBSE for
giving me this opportunity to undertake this subject.
It gave me immense knowledge about the
language(python)
Student Name : Shalvi Bharti
Class and Section: 9-A
Your Name/Class Sec AI/Practical File 3
1. WAP TO PRINT ANY FOUR FLOWER NAMES USING PRINT
STATEMENT.
Q=‘ROSE’
W=‘SUNFLOWER’
E=‘LILY’
R=‘DAISY’
print(Q,W,E,R)
OUTPUT
ROSE SUNFLOWER LILY DAISY
Your Name/Class Sec AI/Practical File 4
2. WAP TO FIND & PRINT THE SUM, PRODUCT & DIFFERENCE OF
ANY 2 NOS
a=int(input(“enter a number”))
b=int(input(“enter a number”))
c=a+b
d=a*b
e=a-b
print(“sum of the given numbers is “,c)
print(“product of the given numbers is “,d)
print(“difference of the given numbers is “,e)
OUTPUT
enter a number1
enter a number2
sum of the numbers is 3
product of the numbers is 2
difference of the numbers is -1
Your Name/Class Sec AI/Practical File 5
3. WAP TO CALCULATE AND PRINT THE AREA AND PERIMETER OF
RECTANGLE.
l=int(input("enter the length of the rectangle"))
b=int(input("enter the breadth of the rectangle"))
j=l*b
q=2*l+2*b
print("perimeter of the rectangle is",q)
print("area of the rectangle is",j)
OUTPUT
enter the length of the rectangle1
enter the breadth of therectangle2
perimeter of the rectangle is 6
area of the rectangle is 2
Your Name/Class Sec AI/Practical File 6
4. WAP TO CALCULATE & PRINT THE SQUARE & CUBE OF A NO
n= int(input("enter a number"))
s= n*n
c=n*n*n
print("square of the given number is",s)
print("cube of the given number is",c)
OUTPUT
enter a number2
square of the given number is 4
cube of the given number is 8
Your Name/Class Sec AI/Practical File 7
[Link] TO INPUT NO. OF DAYS AND CONVERT IT INTO YEARS,
MONTHS AND DAYS
days = int(input("Enter number of days: "))
years = days // 365
days= days % 365
months = days // 30
days = days % 30
print("Years:", years)
print("Months:", months)
print("Days:", days)
OUTPUT
Enter number of days: 1000
Years: 2
Months: 9
Days: 0
Your Name/Class Sec AI/Practical File 8
6. WAP TO INPUT ROLL NO., NAME AND MARKS OF THREE
SUBJECTS & PRINT THE TOTAL & AVERAGE MARKS.
nm=input("enter your name")
roll=int(input("enter your roll number"))
mt=float(input("enter your maths marks"))
sc=float(input("enter your science mark"))
sst=float(input("enter your sst marks"))
tot=mt+sc+sst
av=tot/3
print("total marks are",tot)
print("average marks are",av)
OUTPUT
enter your nameArsh
enter your roll number10
enter your maths marks90
enter your science mark90
enter your sst marks90
total marks are 270.0
average marks are 90.0
Your Name/Class Sec AI/Practical File 9
7. WAP TO INPUT NAME, AGE AND NATIONALITY OF A PERSON AND
TELL IF THE PERSON IS ELIGIBLE TO VOTE OR NOT
nm=input("enter your name")
age=int(input("enter your age"))
nat=input("enter your nationality")
if(nat=="indian" and age>=18):
print("you are eligible to vote")
else:
print("you are not eligible to vote")
OUTPUT
enter your name arsh
enter your age13
enter your nationality indian
you are not eligible to vote
Your Name/Class Sec AI/Practical File 10
8. WAP TO CHECK WHETHER THE NO. IS EVEN/ODD
a=int(input("enter a number"))
b=a%2
if(b%2==0):
print(a,"is an even number")
else:
print(a,"is an odd number")
OUTPUT
enter a number11
11 is an odd number
Your Name/Class Sec AI/Practical File 11
9. WAP TO INPUT ROLL NO., NAME AND MARKS OF FIVE SUBJECTS
& PRINT THE TOTAL & PERCENTAGE AND GRADE
nm=input("enter your name")
roll=int(input("enter your roll number"))
eng=int(input("enter your english marks"))
sc=int(input("enter your science marks"))
mt=int(input("enter your maths marks"))
hin=int(input("enter your hindi marks"))
ssc=int(input("enter your social studies marks"))
tot=eng+sc+mt+hin+ssc
print("total marks is",tot)
per =tot/100*100
print("percentage is",per)
if per(>=90):
print(nm,"has got A grade")
elif per(>=75):
print(nm,"has got B grade")
elif per(>=60):
print(nm,"has got C grade")
elif per(>=40):
print(nm,"has got D grade")
else:
print(nm,"has got E grade")
OUTPUT
enter your name Arsh
enter your roll number10
enter your english marks100
enter your science marks100
enter your maths marks100
enter your hindi marks100
enter your social studies marks100
total marks is 500
percentage is 500.0
Arsh has got A grade
Your Name/Class Sec AI/Practical File 12
10. WAP TO INPUT TWO NOS. AND PRINT ITS + ,-,*,/ ACCORDING TO
THE USER’S CHOICE
a=int(input("enter a number"))
b=int(input("enter a number"))
print("\t\[Link]")
print("\t\[Link]")
print("\t\[Link]")
print("\t\[Link]")
print("\t\t5'exit")
ch=int(input("enter your choice"))
if(ch==1):
print("\t\t sum is",a+b)
elif(ch==2):
print("\t\t difference is",a-b)
elif(ch==3):
print("\t\t product is",a*b)
elif(ch==4):
print("\t\t quotient is”,a/b)
else:
print("\t\t thanks for coming")
OUTPUT
enter a number10060
enter a number60
[Link]
[Link]
[Link]
[Link]
5'exit
enter your choice4
quotient is 167.6666666666666
Your Name/Class Sec AI/Practical File 13
[Link] TO INPUT EMP. CODE, NAME, SALES AND PRINT ITS
COMMISSION
EmpCode=input('Enter employee code')
Name=input('enter employee Name')
sales=float(input('enter sales in lakhs'))
print('For employee: ',EmpCode,' named',Name,' with sales',sales)
if sales>=10:
print('Your commission is 20%')
elif(sales>=5):
print('Your commission is 15%')
elif(sales>=2):
print('Your commission is 10%')
elif(sales>=1):
print('Your commission is 5%')
else:
print('Your commission is 2%')
OUTPUT
Enter employee code266arsh
enter employee Name Sanju
enter sales in lakhs50.0
For employee: 245 named Sanju with sales 50.0
Your commission is 20%
Your Name/Class Sec AI/Practical File 14
[Link] TO PRINT PATTERN USING PRINT STATEMENT
a="#"
print(a*5)
print(a*4)
print(a*3)
print(a*2)
print(a*1)
b="$"
print(b*1)
print(b*2)
print(b*3)
print(b*4)
print(b*5)
OUTPUT
#####
####
###
##
#
$
$$
$$$
$$$$
$$$$$
Your Name/Class Sec AI/Practical File 15
13. WAP TO ACCEPT THE YEAR AND CHECK WHETHER IT IS LEAP
OR NOT
year = int(input("Enter a year: "))
if (year % 400 == 0) and (year % 100 == 0):
print(year, " is a leap year")
elif (year % 4 ==0) and (year % 100 != 0):
print(year, " is a leap year")
else:
print(year, " is not a leap year")
OUTPUT
Enter a year: 1900
1900 is not a leap year
Enter a year: 2024
2024 is a leap year
Your Name/Class Sec AI/Practical File 16
14. WAP TO FIND THE LARGEST OF ANY 2 NOS.
a=int(input("enter a number"))
b=int(input("enter a number"))
if(a>b):
print("the largest of the two number is",a)
else:
print("the largest of the two number is",b)
OUTPUT
enter a number66
enter a number77
the largest of the two number is 77
Your Name/Class Sec AI/Practical File 17
15. WAP TO FIND THE SMALLEST OF ANY 3 DIFFERENT NOS.
a= int(input("enter a number"))
b= int(input("enter another number "))
c= int(input("enter another number"))
if a<b and a<c:
print("the smallest of the three number is ",a)
elif b<a and b<c:
print("the smallest of the three number is ",b)
else:
print("the smallest of the three number is ",c)
OUTPUT
enter a number68
enter another number69
enter another number70
the smallest of the three number is 68
Your Name/Class Sec AI/Practical File 18
16. WAP TO INPUT A NO. & CHECK IS IT POSITIVE/NEGATIVE.
a= int(input("enter a number"))
if a<0:
print(a, " is Negative No. “)
elif if a>0:
print(a, " is Positive No. “)
else:
print(a, " Zero “)
OUTPUT
enter a number68
68 is Positive No.
enter a number -55
-55 is Negative No.
Your Name/Class Sec AI/Practical File 19
17. WAP TO CHECK THE GIVEN NUMBER IS OF ONE DIGITED OR
TWO DIGITED OR THREE DIGITED OR MORE THAN THREE DIGITED.
n = int(input("Enter any number:"))
if n>0 and n<10:
print("One digit number")
elif n>10 and n<100:
print("Two digit number")
elif n>100 and n<1000:
print("Three digit number")
else:
print("More than three digit number")
OUTPUT
Enter any number. 78
Two digit number
Your Name/Class Sec AI/Practical File 20
18. WAP TO CHECK THE ENTERED NUMBER IS SMALLEST 4 DIGIT
NUMBER OR NOT.
n = int(input("Enter any number:"))
if n==1000:
print(n,” is smallest 4 digit no")
else:
print(n, ” is not a smallest 4 digit no")
OUTPUT
Enter any number. 787
787is not a smallest 4 digit no
Your Name/Class Sec AI/Practical File 21
19. WAP TO CHECK THE ENTERED NUMBER IS DIVISIBLE BY 5 OR
NOT.
n = int(input("Enter a number to check:"))
if n%5==0:
print("No is divisible by 5")
else:
print("No is not divisible by 5")
OUTPUT
Enter any number. 788
No is not divisible by 5
Your Name/Class Sec AI/Practical File 22
20. A transport company charges the fare according to following
table:
Distance Charges
1-50 8 Rs./Km
51-100 10 Rs./Km
> 100 12 Rs/Km
Ask user to enter the distance and compute the fare.
distance = int(input("Enter distance:"))
if distance>=1 and distance<=50:
fare = distance * 8
elif distance>=51 and distance<=100:
fare = distance * 10
elif distance>100:
fare = distance * 12
else:
print("Invalid fare")
print("The total fare is:",fare)
OUTPUT
Enter distance: 30
The total fare is: 240
Your Name/Class Sec AI/Practical File 23
FOR LOOP PROGRAMS
21. WAP to print 1st 10 natural nos.
for i in range(1,11,1):
print (i , end = ' ')
OUTPUT
1 2 3 4 5 6 7 8 9 10
22. WAP to print 1st 20 odd nos.
for i in range(1,20,2):
print (i , end = ' ')
OUTPUT
1 3 5 7 9 11 13 15 17 19
Your Name/Class Sec AI/Practical File 24
23. WAP to accept any no. and generate its table.
n = int(input('enter any no.'))
for i in range(1,11,1):
print(n,'*', i, '=', n*i)
OUTPUT
enter any no.78
78 * 1 = 78
78 * 2 = 156
78 * 3 = 234
78 * 4 = 312
78 * 5 = 390
78 * 6 = 468
78 * 7 = 546
78 * 8 = 624
78 * 9 = 702
78 * 10 = 780
24. WAP to find the sum of 1st five even nos.
s=0
for i in range(2,11,2):
s = s+i
print ('sum of 1st five even nos.',s)
OUTPUT
sum of 1st five even nos. 30
Your Name/Class Sec AI/Practical File 25
25. WAP to find the product of 1st ten odd nos.
p=1
for i in range(1,20,2):
p = p*i
print ('Product of 1st ten odd nos.',p)
OUTPUT
Product of 1st ten odd nos. 654729075
Your Name/Class Sec AI/Practical File 26
Q26. WAP to input any no. and print its factor.
n = int(input('enter any no.'))
for i in range(1,n+1):
if n%i == 0:
print(i , end = ‘ ‘)
OUTPUT
enter any no.78
1 2 3 6 13 26 39 78
Your Name/Class Sec AI/Practical File 27
27. WAP to enter any no. and check whether it is prime or not.
num = int(input("Enter a number: "))
if num == 1:
print(num, "is not a prime number")
elif num > 1:
# check for factors
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: 67
67 is a prime number
Your Name/Class Sec AI/Practical File 28