Professional Documents
Culture Documents
Practical: 10: Swaraj Pandey 21162121036 BDA
Practical: 10: Swaraj Pandey 21162121036 BDA
21162121036
BDA
PRACTICAL: 10
import numpy as np
x=np.arange(1,9,1)
print("Total Plants : ",x)
y=x.reshape(4,2)
print(y)
print("Now Two plants died..... ")
temp=y[:3,...]
print(temp)
print("Same type of two plants are added ")
temp2=np.insert(temp,3,3)
temp3=np.insert(temp2,3,3)
print(temp3)
print("Agin reshape the plants in two pair")
z=temp3.reshape(4,2)
print(z)
print("Now two plants died due to less water supply or may poor nutrition and
sunlight")
1
SWARAJ PANDEY
21162121036
BDA
temp4=z[1:]
print(temp4)
print("Now Again reshaping plants and \n Finally you get same type of plants at one
side and remaining on other side")
p=temp4.reshape(2,3)
q=np.sort(p)
print(q)
No. of students 6 x 46 y 8
2
SWARAJ PANDEY
21162121036
BDA
3. A student has scored E1= [20,18,30,22,15] marks (out 0f 40) and E2 = [19,
22,33,30,19] during 2 mid semester exams. A teacher is supposed to
graphically show the difference of marks and compare performances of
student. Help the teacher to do graphical representation
import numpy as np
from matplotlib import pyplot as pt
p=np.array([20,18,30,22,15])
x=np.array([1,2,3,4,5])
q=np.array([19,22,33,30,19])
pt.title("Results")
pt.xlabel("Subjects")
3
SWARAJ PANDEY
21162121036
BDA
pt.ylabel("Marks ")
pt.plot(x,p,'b-')
pt.plot(x,q,'g-')
pt.show()
Output: