Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

SWARAJ PANDEY

21162121036
BDA

PRACTICAL: 10

1. A housekeeper is supposed to keep 8 plants in entrance of house to make it


decorative. he initially arranges all 8 plants in single row keeping to make it
look like a fencing to garden area of house. The next day, the owner of the
house seems isn’t happy enough by the arrangement made by the
housekeeper and asks him to place it equally on both sides of entrance. All
the plants are of different sizes and types. After few days, proper care to
plants is giving by providing adequate amount of water and two different
nutrition to it. Due to much sunlight 2 plants are destroyed and the owner
decides to replace it with 2 new plants of a specific existing type only. Also
owner thinks to take away 2 different plants to other side of house. Finally,
owner thinks to rearrange alike plants together and keep them on one side
and rest all on other Kindly help the housekeeper to make possible
arrangements.

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)

2. University conducts examination (practical + theory) for students. The following


frequency distribution tables shows the marks obtained by 100 students:

Theory Marks 0-20 20-40 40-60 60-80 80-100

No. of students 6 x 46 y 8

Practical 0-20 20-40 40-60 60-80 80-100


Marks
No. of students 10 28 X y 32

2
SWARAJ PANDEY
21162121036
BDA

As shown above, while making entry the exam controller is unable to


understand few entries made by examiner, kindly help controller to identify no.
Of students. Also, plot a histogram corresponding to practical examination
result.
import numpy as np
from matplotlib import pyplot as pt
x=np.array([22,87,5,43,56,73,55,54,11,20,51,5,79,31,27])
np.histogram(x,bins=[0,20,40,60,80,100])
hist,bins = np.histogram(x,bins=[0,20,40,60,80,100])
print(hist)
print(bins)
pt.hist(x,bins=[0,20,40,60,80,100])
pt.title("Histogram")
pt.show()

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:

You might also like