0% found this document useful (0 votes)
10 views7 pages

Grade 9 Python Lab Exam Programs

The document contains a series of Python programs designed for a Grade 9 lab practical exam, covering various topics such as calculating surface area and volume, checking even or odd numbers, and performing arithmetic operations. Each program includes a brief description, source code, and sample output demonstrating its functionality. The exercises aim to enhance students' programming skills through practical applications.

Uploaded by

smdamaan774
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views7 pages

Grade 9 Python Lab Exam Programs

The document contains a series of Python programs designed for a Grade 9 lab practical exam, covering various topics such as calculating surface area and volume, checking even or odd numbers, and performing arithmetic operations. Each program includes a brief description, source code, and sample output demonstrating its functionality. The exercises aim to enhance students' programming skills through practical applications.

Uploaded by

smdamaan774
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Grade 9 Python programs (Lab Practical Exam) 25-26

Program 1:
Write a program to calculate the surface area and volume of a cuboid.
Source code:

Output:
Enter the three dimensions of the cuboid:
Enter Length : 20
Enter Width : 14
Enter Height : 10
Surface area: 1240.0
Volume: 2800.0
------------------------------------------------------------------------------------------------------------------------------------------

Program 2: Write a program to check whether the given number is even or odd.
Source code:

Output:
Enter any number: 56
56 is an EVEN number
------------------------------------------------------------------------------------------------------------------------------------------
Program 3: Write a program to check whether the applicant is eligible for vote in the elections
Source code:

Page 1 of 7
Output:
Enter your age: 46
Congratulations you are eligible to vote.
------------------------------------------------------------------------------------------------------------------------------------------

Program 4: Write a program to check whether the entered number is positive and even, positive odd, negative even or
negative odd.
Source code:

Output:
Enter any number: 56
The number is POSITIVE EVEN number
------------------------------------------------------------------------------------------------------------------------------------------
Program 5: Write a program to find the sum of all the number stored in a list number= [6,5,3,8,4,2,5,4,11]
Source code:

Page 2 of 7
Output:
List: [6, 5, 3, 8, 4, 2, 5, 4, 11]
Sum of all numbers = 48
------------------------------------------------------------------------------------------------------------------------------------------
Program 6: Write a program to print personal information, like Name, Father’s name, class, school name.
Source code:

Output:
Enter your name: Abdul
Enter your father's name: Rahman
Enter your class (like 9th or IX): 9
Enter your school name: creekside international high school
YOUR PERSONAL INFORMATION
Name : abdul
Father's Name: Rahman
Class :9
School : creekside international high school
------------------------------------------------------------------------------------------------------------------------------------------

Program 7: Write a program to calculate the area and perimeter for a rectangle.
Source Code:

Output:
Enter length of rectangle : 9
Enter width of rectangle : 6

Page 3 of 7
Area of rectangle = 54.0
Perimeter of rectangle = 30.0
------------------------------------------------------------------------------------------------------------------------------------------

Program 8: Accept the marks from user and calculate the average marks of 3 subjects.
Source code:

Output:
Enter marks of Subject 1: 99
Enter marks of Subject 2: 98
Enter marks of Subject 3: 0The Average entered three subjects are = 65.66666666666667

------------------------------------------------------------------------------------------------------------------------------------------

Program 9: Create a list in python of children selected for a science quiz with the following names:
Arjun, Vikram, sandhya, sonal, Isha and Karthik
Perform the following task on the list in sequence:
a) Print the whole list
b) Delete the name “Vikram” from the list
c) Add the name “jay” at the end
d) Remove the item that is at the second position

Page 4 of 7
Output:
a) Original list: ['Arjun', 'Vikram', 'Sandhya', 'Sonal', 'Isha', 'Karthik']
b) After removing Vikram: ['Arjun', 'Sandhya', 'Sonal', 'Isha', 'Karthik']
c) After adding Jay at the end: ['Arjun', 'Sandhya', 'Sonal', 'Isha', 'Karthik', 'Jay']
d) After removing the second position item Removed name: Sandhya Final list: ['Arjun', 'Sonal', 'Isha', 'Karthik', 'Jay']
------------------------------------------------------------------------------------------------------------------------------------------

Q10) Create a list list_1=[10,20,30,40] and


a) add the elements [14, 15, 12] using extend function.
b) Sort the final list in ascending order and print it
Source code:

Output:
Original list: [10, 20, 30, 40]
After using extend ([14, 15, 12]): [10, 20, 30, 40, 14, 15, 12]
Final sorted list (ascending order): [10, 12, 14, 15, 20, 30, 40]
------------------------------------------------------------------------------------------------------------------------------------------

Page 5 of 7
Q11) Write a program to accept two values from user and perform any four arithmetic operations.
Source code:

Output:
Enter num1: 20
Enter num2: 50
Sum of num1 and num2 is 70.0
subtraction of num1 and num2 is -30.0
multiplication of num1 and num2 is 1000.0
Division of num1 and num2 is 0.4
------------------------------------------------------------------------------------------------------------------------------------------
Q12) Write a program to print numbers from 1 to 10 using range(n) function
Source Code:

Output:
123456789
------------------------------------------------------------------------------------------------------------------------------------------

Q13) To find the sum of two numbers 15 and 20.2


Source Code:

Output:
The sum of two number 15 and 20.5 are : 35.5
------------------------------------------------------------------------------------------------------------------------------------------
Page 6 of 7
Q14) Write a program to display message “welcome” 5 times using looping statement (for or while).
Source code:

Output:
Welcome
Welcome
Welcome
Welcome
Welcome
------------------------------------------------------------------------------------------------------------------------------------------

Page 7 of 7

You might also like