[go: up one dir, main page]

0% found this document useful (0 votes)
26 views5 pages

Class 10 Practical File

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)
26 views5 pages

Class 10 Practical File

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
You are on page 1/ 5

Class – X

Session – 2023-24
Practical Work
1. 1. Write a Python code to input and print personal information like Name, Father’s
Name, Class, School Name of a student.
# To print personal information
name = input(“enter name: ”) Output
fname = input(“enter father name: ”)
cls = input(“enter class: ” ) On the left Page
school_name = input(“enter school name: ”) (Blank Page) of the
print(“name: ”, name) File
print(“father name: ”, fname)
print(“class: ”, cls)
print(“school name: ”, school_name)

2. 2. Write a Python code to calculate Area and Perimeter of a rectangle.


l=int(input("length")) Output
b=int(input("breadth"))
area=l*b On the left Page
perimeter=2*(l+b) (Blank Page) of the
print("area:",area) File
print("perimeter:",perimeter)

3. To calculate discounted amount with discount %


amount=float(input("amount")) Output
dis=float(input("discount % ")) On the left Page
discount=(amount*dis)/100 (Blank Page) of the
dis_amt = amount-discount File ……PG-49
print("discounted amt:",dis_amt)
0 1 23 4 5
3. Create a list num=[23,12,5,9,65,44]
-6 -5 -4-3 -2 -1
a. Print the length of the list
b. Print the elements from second to fourth position using positive indexing
c. Print the elements from position third to fifth using negative indexing
num=[23,12,5,9,65,44] Output
On the left Page
print(len(num))
(Blank Page) of the
print(num[1:4]) File
print(num[-4:-1])
5. Create a list list1=[10,20,30,40]
Add the elements [14,15,12] using extend a function.
Now sort the final list in ascending order and print it.
list1=[10,20,30,40] Output
On the left Page
list1.extend([14,15,12])
(Blank Page) of the
print(list1) File
list1.sort(reverse=False)
print(list1)
6. Program to check if a person can vote.

age= int(input("Enter age = ")) Output


if age>=18: On the left Page
print("Eligible for Vote") (Blank Page) of the
else: File……PG-79
print("Not Eligible for Vote")
7. To print first 10 natural numbers
for i in range(1,11,1):
print(i)
or
i=1
while i<=10:
print(i)
i=i+1
8. Program to find the sum of all numbers stored in a list
sum=0
lst1 = [10,12,14,16,18,20]
a = len(lst1)
for i in range(0,a):
sum=sum+lst1[i]
print(sum)

9. Write a program to add the elements of the two lists.


lst1 = [10,12,14,16,18,20]
lst2 = [10,12,14,16,18,20]
a=len(lst1)
for i in range(0,a):
print(lst1[i]+lst2[i])
10. Write a program to calculate mean, median and mode
Create an excel file
Save as “student_record.csv”

import pandas as pd
df = pd.read_csv("D:\KALPANA\STUDENT_RECORD.csv")
print(df)
print(df.mean())
print(df.median())
print(df.mode())

11. Write a program to display line chart from (2,5) to (9,10).


import matplotlib.pyplot as plt
xdata=[2,9]
ydata=[5,10]
plt.plot(xdata,ydata)
plt.title('Sample Line Chart between 2 points')
plt.xlabel('xdata')
plt.ylabel('ydata')
plt.show()
12. Write a program to display a scatter chart for the following points
(2,5), (9,10),(8,3),(5,7),(6,18).
import matplotlib.pyplot as plt
xdata=[2,9,8,5,6]
ydata=[5,10,3,7,18]
plt.scatter(xdata,ydata)
plt.title('Sample Scatter Chart between 5 points')
plt.xlabel('xdata')
plt.ylabel('ydata')
plt.show()
13. Read csv file saved in your system and display 10 rows.
import pandas as pd
data = pd.read_csv(" D:\KALPANA\STUDENT_RECORD.csv ")
print(data.head(10))

14. Read csv file saved in your system and display its information
import pandas as pd
data = pd.read_csv(" D:\KALPANA\STUDENT_RECORD.csv")
print(data)

15. Write a program to read an image and display using Python


pip install opencv-python
import cv2

# Read an image
image = cv2.imread(‘sample.jpg')

# Display the image in a window


cv2.imshow('Image', image)

You might also like