0% found this document useful (0 votes)
12 views11 pages

Class 10 Practical File Jyotika

Uploaded by

simmygangal
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)
12 views11 pages

Class 10 Practical File Jyotika

Uploaded by

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

CLASS 10 PRACTICAL FILE

MADE BY VIBHA SIKRI

Q1.Write a program to add elements of two list.

Program

test_list1 = [1, 3, 4, 6, 8]
test_list2 = [4, 5, 6, 2, 10]

# printing original lists


print ("Original list 1 : " + str(test_list1))
print ("Original list 2 : " + str(test_list2))

# using naive method to


# add two list
res_list = []
for i in range(0, len(test_list1)):
res_list.append(test_list1[i] + test_list2[i])

# printing resultant list


print ("Resultant list is : " + str(res_list))

Q2.Write a program to calculate mean ,median , mode using NUMPY

Program :
import numpy as np
a = [1,2,2,4,5,6]
print(np.mean(a))
import numpy as np
a = [1,2,2,4,5,6]
print(np.median(a))
import numpy as np
a = [1,2,2,2,4,5,6,6]
values,counts = np.unique(a, return_counts=True)
mode = values[np.argmax(counts)]
print(mode)

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

import matplotlib.pyplot as plt


import numpy as np
plt.plot([2,5], [9,10])
plt.show()
Q4. Write a program to plot scatter chart for the following points

(2,5) (9,10),(8,3),(5,7),(6,18)

import matplotlib.pyplot as plt


import numpy as np
plt.scatter(2,5)
plt.scatter(9,10)
plt.scatter(8,3)
plt.scatter(5,7)
plt.scatter(6,18)
Q5 Write a program in python to display image using opencv.

import cv2
import matplotlib.pyplot as plt
import numpy as np
img = cv2.imread(r'C:\Users\jsspsn\Desktop\school.jpg')
plt.imshow(img)
plt.title('SCHOOL')
plt.axis('off')
plt.show()
Q6 Write a program to calculate the area of a triangle
Program

B=int(input("enter the value of the breadth of the triangle"))


H=int(input("enter the value of the height of the triangle"))
Area=(1/2*B*H)
print(Area)

Q7. Write a program to calculate the average of 3 numbers


Program

num1=int(input('enter a number1:'))
num2=float(input('enter a number2:'))
num3=int(input('enter a number3:'))
Average=(num1+num2+num3/3)
print(Average)

Q8. Write a program to check the largest of the 3 numbers


Program
a=int(input("enter a number A"))
b=int(input("enter a number B"))
c=int(input("enter a number C"))
if(a>=b) and (a>=c):
largest=a
elif(b>=a) and (b>=c):
largest=b
else:
largest=c
print('the largest number is',largest)

Q9. Write a program to remove elements from a list


Program

list=[1,2,3,4,5]
print(list)
list.remove(4)
print(list)

Q10. Write a program to print the multiplication table of a number


Program

A=int(input("Enter the number"))


print("Multiplication table of",A,"is")
for i in range(1,11):
B=A*i
print(A,"X",i,"=",B)

Q11. Write a program to find if a character is a vowel or a consonant.


Program

ch=input("Enter a character:")
if(ch=='a' or ch=='e' or ch=='i' or ch=='o' or ch=='u' or ch=='A' or ch=="E" or ch=='
I' or ch=='O' or ch=='U'):
print(ch,"is a vowel")
else:
print(ch,"is a consonant")

Q12. Write a program to print leap years from 1900 to 2010


Program
print("Leap years from 1900-2010 are")
for i in range(1900,2011):
if(i%4==0):
print("The leap years are",i)

Q13.Write a program to calculate the sum of numbers from m to n


Program

m=int(input('enter the value of m'))


n=int(input('enter the value of n'))
s=0
while(m<=n):
s=s+m
m=m+1
print("Sum is",s)

Q14. write a program to allot grades to a student's average marks


Program

a=int(input('enter the students average marks'))


if(a>=75):
print('Grade O')
elif(60<=a<75):
print('Grade A')
elif(50<=a<60):
print('Grade B')
elif(40<=a<50):
print('Grade C')
else:
print('Grade D')
Q15. Write a program to check whether its a prime number
Program
a=int(input('enter a number A:'))
if a > 1:

for i in range(2, (a//2)+1):

if (a % i) == 0:
print(a, "is not a prime number")
break
else:
print(a, "is a prime number")
else:
print(a, "is not a prime number")

You might also like