0% found this document useful (0 votes)
4 views3 pages

Class 10 Python Practical

The document provides Python practical exercises for Class 10, covering various topics such as list manipulation, statistical calculations (mean, median, mode), factorial computation, data visualization with scatter and bar charts, reading CSV files, image processing, and basic string analysis. Each exercise includes code snippets demonstrating the implementation of the concepts. The exercises also cover mathematical concepts like LCM, palindrome checking, and prime number identification.

Uploaded by

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

Class 10 Python Practical

The document provides Python practical exercises for Class 10, covering various topics such as list manipulation, statistical calculations (mean, median, mode), factorial computation, data visualization with scatter and bar charts, reading CSV files, image processing, and basic string analysis. Each exercise includes code snippets demonstrating the implementation of the concepts. The exercises also cover mathematical concepts like LCM, palindrome checking, and prime number identification.

Uploaded by

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

Class 10 Python Practical Answers

1. Add elements of two lists


---------------------------
S1 = [32, 45, 40]
S2 = [35, 30, 42, 38]
All = S1 + S2
print(All)

2. Mean, Median and Mode


-----------------------
import statistics
d = [95,90,49,71,90,100,55]
print([Link](d))
print([Link](d))
print([Link](d))

3. Factorial of a number
-----------------------
n = int(input("Enter a number: "))
fact = 1
for i in range(1, n+1):
fact *= i
print(fact)

4. Scatter Chart
----------------
import [Link] as plt
import numpy as np
x = [Link]([2,9,8,5,6])
y = [Link]([5,10,3,7,18])
[Link](x,y)
[Link]()

5. Read CSV file


----------------
import pandas as pd
df = pd.read_csv("D:/[Link]")
print(df)

9. Display an Image
------------------
import cv2
from matplotlib import pyplot as plt
img = [Link]("D:/[Link]")
[Link](img)
[Link]("My Favourite City")
[Link]("off")
[Link]()

10. Image Shape


---------------
image = [Link]("D:/[Link]")
print([Link])

11. Count vowels and consonants


------------------------------
s = input("Enter string: ")
v=c=0
for i in s:
if [Link]() in 'aeiou':
v += 1
elif [Link]():
c += 1
print(v, c)

13. LCM of two numbers


---------------------
def lcm(x,y):
g = max(x,y)
while True:
if g%x==0 and g%y==0:
return g
g+=1

14. Palindrome number


--------------------
num = int(input())
rev = int(str(num)[::-1])
print(num==rev)

15. Prime number


---------------
n = int(input())
for i in range(2,n):
if n%i==0:
print("Not prime")
break
else:
print("Prime")

18. Bar Chart


-------------
import [Link] as plt
areas = ['a1','a2','a3','a4','a5']
votes = [23,45,31,40,35]
[Link](areas,votes)
[Link]()

You might also like