PYTHON PROGRAM FOR PRACTICAL WORK CLASS X
Problem Statements
1. To print personal information like Name, Father’s Name, Class, School
Name.
2. To print the following patterns using multiple print commands
*
**
***
****
*****
3. To print the following patterns using multiple print commands
*****
****
***
**
*
4. To calculate Simple Interest if the principle_amount = 2000
rate_of_interest = 4.5 time = 10
5. Input a number and check if the number is positive, negative or zero and
display an appropriate message
6. To print first 10 natural numbers
7. 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-
i) Print the whole list
ii) Delete the name “Vikram” from the list
iii) Add the name “Jay” at the end
iv) Remove the item which is at the second position
8. Write a program to add the elements of the two lists.
9. Write a program to calculate mean, median and mode using Numpy
[Link] a program to display line chart from (2,5) to (9,10).
[Link] a program to display a scatter chart for the following points (2,5),
(9,10),(8,3),(5,7),(6,18).
[Link] the csv file saved in your system and display 10 rows.
[Link] csv file saved in your system and display its information
[Link] a program to read an image and display using Python
[Link] a program to read an image and identify its shape using Python.
HINTS
1. Print Personal Information
Use the print() function.
Write separate print() statements for each detail.
Enter the values directly as text inside quotation marks.
Expected Output:
Name: Riya Sharma
Father's Name: Mr. Rajesh Sharma
Class: 10th
School Name: PM SHRI KV Ballygunge
2. Increasing Star Pattern (Using Loop)
Use a for loop to repeat 5 times.
The loop should start from 1 and go up to 5.
Inside the loop, print the "* " symbol multiplied by the loop variable (to repeat it).
Expected Output:
*
**
***
****
*****
3. Decreasing Star Pattern (Using Loop)
Use a for loop to count from 5 down to 1.
Inside the loop, print "* " multiplied by the loop variable.
Make sure to decrease the loop value in each iteration.
Expected Output:
*****
****
***
**
*
4. Calculate Simple Interest
Use variables to store principal amount, rate of interest, and time.
Use the formula: (P × R × T) / 100 to calculate interest.
Print the result using the print() function.
Expected Output:
Simple Interest is: 900.0
5. Check Positive, Negative, or Zero
Ask the user to input a number using input() and convert it to int or float.
Use if, elif, and else to check if the number is:
Greater than 0 → Positive
Less than 0 → Negative
Equal to 0 → Zero
Print the appropriate message.
Expected Output:
if input is 7
The number is Positive
if input is -3
The number is Negative
if input is 0
The number is Zero
6. Print First 10 Natural Numbers
Use a for loop that starts from 1 and goes up to 10.
In each iteration, print the loop variable.
Use print() to show each number.
Expected Output:
1
2
3
4
5
6
7
8
9
10
7. List Operations with Student Names
Create a list with all the names.
Print the list using print().
Use the remove() function to delete "Vikram".
Use the append() function to add "Jay".
Use the del statement to remove the item at index 1 (second position).
Print the final updated list.
Expected Output:
Original list:
['Arjun', 'Sonakshi', 'Vikram', 'Sandhya', 'Sonal', 'Isha', 'Kartik']
After removing 'Vikram':
['Arjun', 'Sonakshi', 'Sandhya', 'Sonal', 'Isha', 'Kartik']
After adding 'Jay':
['Arjun', 'Sonakshi', 'Sandhya', 'Sonal', 'Isha', 'Kartik', 'Jay']
After removing second element:
['Arjun', 'Sandhya', 'Sonal', 'Isha', 'Kartik', 'Jay']
8. Add Elements of Two Lists
Create two lists with the same number of numbers.
Create an empty list to store results.
Use a for loop to go through each index.
Add corresponding elements and store in the new list.
Print the resulting list.
Expected Output:
List1: [2, 4, 6]
List2: [1, 3, 5]
Sum List: [3, 7, 11]
9. Calculate Mean, Median, Mode with NumPy
Import numpy and statistics libraries.
Create a list or array of numbers.
Use appropriate functions from each library to calculate:
Mean
Median
Mode
Print the results.
Expected Output:
Mean: 5.2 (value can differ according to your input)
Median: 5.0 (value can differ according to your input)
Mode: 3 (value can differ according to your input)
10. Line Chart from (2,5) to (9,10)
Import [Link].
Create two lists: one for x-values and one for y-values.
Use the plot() function with x and y.
Use show() to display the chart.
Expected Output:
A line graph will appear with a line connecting the points (2,5) and (9,10).
You will see a straight diagonal line.
11. Scatter Chart with Given Points
Import [Link].
Create two lists:
One for x-coordinates
One for y-coordinates
Use the scatter() function with x and y.
Call show() to display the plot.
Expected Output:
A scatter plot will appear with points plotted at:
(2,5)
(9,10)
(8,3)
(5,7)
(6,18)
Each will show as a dot on the graph.
12. Read CSV and Display 10 Rows
Import pandas as pd.
Use read_csv() to load the file from your system.
Use the head() function with argument 10 to show the first 10 rows.
Print the result.
Expected Output:
ID Name Class
0 1 Riya 8
1 2 Aarav 7
2 3 Isha 8
...
9 10 Neha 7
13. Read CSV and Show File Information
Import pandas.
Load the CSV file using read_csv().
Call the info() method on the DataFrame.
This will show columns, data types, and memory usage.
Expected Output:
<class '[Link]'>
RangeIndex: 30 entries, 0 to 29
Data columns (total 3 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 ID 30 non-null int64
1 Name 30 non-null object
2 Class 30 non-null int64
dtypes: int64(2), object(1)
memory usage: 848.0 bytes
None
14. Read and Display an Image
Import the cv2 module from OpenCV.
Use [Link]() to read an image file.
Use [Link]() to display the image in a window.
Add [Link]() and [Link]() to handle the window properly.
Expected Output:
A window opens showing the image file you selected.
The window waits for a key press before it closes.
15. Read Image and Identify Shape
Import cv2 and numpy.
Read the image and convert it to grayscale.
Use [Link]() to detect edges.
Use [Link]() to approximate the shape.
Count the number of edges/sides to identify:
Triangle, Square, Rectangle, etc.
Display the image and the shape name.
Expected Output:
Detected Shape: Rectangle