Class IX – AI (417) Practical File
[Link] Practical Teacher’
s Sign
1 Write a program to print personal information like Name, Father’s Name, Class,
School Name.
2 Write a program to print the following patterns using multiple print commands-
a) * b) *
* * * *
* * * * * *
* * * * * * * *
3 Write a program to find square of number 7.
4 Write a program to find the sum of two numbers 15 and 20.
5 Write a program to convert length given in kilometres into meters (Let 5 km).
6 Write a program to print the table of 5 up to five terms.
7 Write a program to calculate Simple Interest if the principle_amount = 2000
rate_of_interest = 4.5 time = 10.
8 Write a program to calculate Area and Perimeter of a rectangle.
9 Write a program to calculate Area of a triangle with Base and Height.
10 Write a program to calculating average marks of 3 subjects.
11 Write a program to calculate Surface Area and Volume of a Cuboid.
12 Write a program to create a list in Python of children selected for science quiz with
following names - Arjun, Sonakshi, Vikram, Sandhya, Sonal, Isha, Kartik
Perform the following tasks on the list in sequence-
○ Print the whole list
○ Delete the name “Vikram” from the list
○ Add the name “Jay” at the end
○ Remove the item which is at the second position
13 Write a program to create a list num=[23,12,5,9,65,44]
○ print the length of the list
○ print the elements from second to fourth position using positive indexing
○ print the elements from position third to fifth using negative indexing
14 Write a program to create a list of first 10 even numbers, add 1 to each list item
and print the final list.
15 Write a program to create a list List_1=[10,20,30,40]. Add the elements [14,15,12]
using extend function. Now sort the final list in ascending order and print it.
16 Write a program to check if a person can vote.
17 Write a program to check the grade of a student.
18 Write a program to input a number and check if the number is positive, negative or
zero and display an appropriate message.
19 Write a program to print first 10 natural numbers
20 Write a program to print first 10 even numbers
21 Write a program to print odd numbers from 1 to n
22 Write a program to print sum of first 10 natural numbers
23 Write a program to find the sum of all numbers stored in a list
Program-1
Ques. Write a program to print personal information like Name, Father’s Name, Class, School Name.
Code:-
print(“Namaskar!”)
print(“My name is Raghav Sharma”)
print(“I study in Class 9 in MPS school”)
print(“Today is my practical day of AI”)
print(“Thank You”)
Output:-
Namaskar
My name is Raghav Sharma
I study in class 9 in MPS school
Today is my practical day of AI
Thank You
Program-2
Ques. Write a program to print the following patterns using multiple print commands-
a) * b) *
* * * *
* * * * * *
* * * * * * * *
Code:- (a)
print(“*”)
print(“* *”)
print(“* * *”)
print(“* * * *”)
Code:- (b)
print(“ * ”)
print(“ * * ”)
print(“ * * * ”)
print(“* * * * ”)
Output:-
a) * b) *
* * * *
* * * * * *
* * * * * * * *
Program-3
Ques. Write a program to find square of number 7.
Code:-
print(7*7)
OR
print(7**2)
Output:-
49
Program-4
Ques. Write a program to find the sum of two numbers 15 and 20.
Code:-
print(15+20)
OR
A=15
B=20
print(“The sum of 15 and 20 is=”, A+B)
Output:-
35
The sum of 15 and 20 is=35
Program-5
Ques. Write a program to convert length given in kilometres into meters (Let 5 km).
Code:-
print(“5 km into meters is =”, 5*1000)
Output:-
5 km into meters is =5000
Program-6
Ques. Write a program to print the table of 5 up to five terms.
Code:-
print(“5*1 =”, 5*1)
print(“5*2 =”, 5*2)
print(“5*3 =”, 5*3)
print(“5*4 =”, 5*4)
print(“5*5 =”, 5*5)
Output:-
5*1 = 5
5*2 =10
5*3 =15
5*4 =20
5*5 =25
Program-7
Ques. Write a program to calculate Simple Interest if the principle_amount = 2000 rate_of_interest =
4.5 time = 10.
Code:-
P = 2000
R = 4.5
T = 10
SI=(“The simple interest is=”,(P* R* T)/100)
Output:-
The simple interest is =900
Program-8
Ques. Write a program to calculate Area and Perimeter of a rectangle.
Code:-
L=int(input("Enter Length:"))
B=int(input("Enter Breadth:"))
Area=L*B
Perimeter=2*(L+B)
print("Area=",Area)
print("Perimeter=",Perimeter)
Output:-
Program-9
Ques. Write a program to calculate Area of a triangle with Base and Height.
Code:-
base=float(input("Enter base of the Triangle:"))
height=float(input("Enter height of the Triangle:"))
Area=1/2*base*height
print("Area:",Area)
Output:-
Program-10
Ques. Write a program to calculating average marks of 3 subjects.
Code
hindi=int(input("Enter marks of Hindi="))
english=int(input("Enter marks of english ="))
maths=int(input("Enter marks of maths="))
total_marks=hindi+engllish+maths
print("Total marks=", total_marks)
avg_marks=total_marks/3
print("Average marks=", avg_marks)
Output
Program-11
Ques. Write a program to calculate Surface Area and Volume of a Cuboid
Code
L=int(input("Enter Length:"))
W=int(input("Enter Width:"))
H=int(input("Enter Height:"))
surface_area= 2 * (L * W + W * H + L * H)
volume=2 *H * (L + B)
print("Surface Area=", surface_area)
print("Volume=", volume)
Output
Program-12
Ques. Write a program to create a list in Python of children selected for science quiz with following
names - Arjun, Sonakshi, Vikram, Sandhya, Sonal, Isha, Kartik
Perform the following tasks on the list in sequence-
○ Print the whole list
○ Delete the name “Vikram” from the list
○ Add the name “Jay” at the end
○ Remove the item which is at the second position
Code
Name=[ ‘Arjun’, ‘Sonakshi’, ‘Vikram’, ‘Sandhya’, ‘Sonal’, ‘Isha’, ‘Kartik’]
#1 Print the whole list
Print(Name)
#2 Delete the name “Vikram” from the list
[Link](‘Vikram’)
print(Name)
#3 Add the name “Jay” at the end
[Link](‘Jay’)
print(Name)
#4 Remove the item which is at the second position
[Link](1)
print(Name)
Output
Program-13
Ques. Write a program to create a list num=[23,12,5,9,65,44]
○ print the length of the list
○ print the elements from second to fourth position using positive indexing
○ print the elements from position third to fifth using negative indexing
Code
num=[23,12,5,9,65,44]
#1 Length of the list-
print(“Length of the list num is -”,len(num))
#2 elements from second to fourth position
print(num[1:4])
#3 elements from second to fourth position using positive indexing
print(num[1:4])
#4 elements from position third to fifth using negative indexing
print(num[-4:-1])
Output
Program-14
Ques. Write a program to create a list of first 10 even numbers, add 1 to each list item and print the final
list.
Code
even_numbers = [2 * i for i in range(1, 11)]
modified_numbers = [num + 1 for num in even_numbers]
print(modified_numbers)
Output
Program-15
Ques. Write a program to create a list List_1=[10,20,30,40]. Add the elements [14,15,12] using extend
function. Now sort the final list in ascending order and print it.
Code
List_1 = [10, 20, 30, 40]
List_1.extend([14, 15, 12])
List_1.sort()
print(List_1)
Output
Program-16
Ques. Write a program to check if a person can vote.
Code
age = int(input("Enter age : "))
if age >= 18:
print("Eligible for Voting!")
else:
print("Not Eligible for Voting!")
Output
Program-17
Ques. Write a program to check the grade of a student.
Code
marks = int(input("Enter your total marks : "))
if marks >= 90:
print('Grade A')
elif marks >= 80:
print('Grade B')
elif marks >= 60:
print('Grade C')
elif marks >= 50:
print(‘Grade D’)
else:
print(‘Fail’)
Output
Program-18
Ques. Write a program to input a number and check if the number is positive, negative or zero and
display an appropriate message.
Code
number = float(input("Enter a number: "))
if number > 0:
print("The number is positive.")
elif number < 0:
print("The number is negative.")
else:
print("The number is zero.")
Output
Program-19
Ques. Write a program to print first 10 natural numbers .
Code
for i in range(1, 11):
print(i)
Output
Program-20
Ques. Write a program to print first 10 even numbers
Code
print("The first 10 even numbers are:")
for i in range(1, 11): # Iterate from 1 to 10 (inclusive)
print(2 * i) # Multiply each number by 2 to get an even number
Output
Program-21
Ques. Write a program to print first 10 even numbers
Code
print("The first 10 even numbers are:")
for i in range(1, 11): # Iterate from 1 to 10 (inclusive)
print(2 * i) # Multiply each number by 2 to get an even number
Output
Program-22
Ques. Write a program to print odd numbers from 1 to n
Code
n = int(input(“enter the maximum value of n”))
for i in range(n):
if (i % 2 == 1):
print(i, end = ' ')
Output
Program-23
Ques. Write a program to find the sum of all numbers stored in a list.
Code
numbers = [10, 20, 30, 40, 50]
total_sum = sum(numbers)
print(f"The sum of the numbers is: {total_sum}")
Output