Practical File Class 9
Practical File Class 9
Malhotra
ix- E
Artificial intelligence practical file
2024-25
IX/AI/Practical File 1
CERTIFICATE
This is to certify that Swastik Malhotra of class IX-
E, Rosary Sr. Sec. School, Delhi has successfully
completed this Python Practical File for the AISSCE
as prescribed by CBSE in the year 2024-2025.
Date: _______________
Signature
__________________
IX/AI/Practical File 2
ACKNOWLEDGEMENT
IX/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
IX/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
IX/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
IX/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
IX/AI/Practical File 7
5. WAP TO INPUT NO. OF DAYS AND CONVERT IT INTO YEARS,
MONTHS AND DAYS
OUTPUT
Enter number of days: 1000
Years: 2
Months: 9
Days: 0
IX/AI/Practical File 8
6. WAP TO INPUT ROLL NO., NAME AND MARKS OF THREE
SUBJECTS & PRINT THE TOTAL & AVERAGE MARKS.
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
IX/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
OUTPUT
enter your name arsh
enter your age13
enter your nationality Indian
you are not eligible to vote
IX/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 a even number")
else:
print(a,"is a odd number")
OUTPUT
enter a number11
11 is a odd number
IX/AI/Practical File 11
9. WAP TO INPUT ROLL NO., NAME AND MARKS OF FIVE SUBJECTS
& PRINT THE TOTAL & PERCENTAGE AND 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
IX/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\t1.add")
print("\t\t2.subtract")
print("\t\t3.multiply")
print("\t\t4.division")
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
1.add
2.subtract
3.multiply
4.division
5'exit
enter your choice4
quotient is 167.6666666666666
IX/AI/Practical File 13
11.WAP 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%
IX/AI/Practical File 14
12.WAP 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
#####
####
###
##
#
$
$$
$$$
$$$$
$$$$$
IX/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
IX/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
IX/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
IX/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.
IX/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.
OUTPUT
Enter any number. 78
Two digit number
IX/AI/Practical File 20
18. WAP TO CHECK THE ENTERED NUMBER IS SMALLEST 4 DIGIT
NUMBER OR NOT.
OUTPUT
Enter any number. 787
787is not a smallest 4 digit no
IX/AI/Practical File 21
19. WAP TO CHECK THE ENTERED NUMBER IS DIVISIBLE BY 5 OR
NOT.
OUTPUT
Enter any number. 788
No is not divisible by 5
IX/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.
OUTPUT
Enter distance: 30
The total fare is: 240
IX/AI/Practical File 23