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

?r, dort ?

sBudent-nehore kJ . appeno i)
Student -nchwork (jJ. append[ )

b)
student utend(un):
dludent-id =usen["ld"J
fríend-Pd tudent-network [hudort-f]
)
rohurn len (hr'end- íd

moathrien
frint( meat-jnlrd.sort())
student feiond (uan)) tore
meot-feiend: (uarrt[aJ,um- stuclent and no. bg frieró
in student] tuple
lambda
mat - rien SortC
rceneae Trle)

print (mont -griend).


ushen rterlaced
Outpt Qrutput
1
d

d 120
4
a) a) unnamed ang :(1, a, 3)
':'soa', Kiya':

ongumos sheutod bouooptbral


NO, Kegusotd
onguenti only
import sandom
import matpiotib Pyplot as plt

plt.hist (random-int,bins r a0)


ptt.alaloel (Random-ntegen ')
pe y'abet ("Frequeny? Random

as plt
imporct matpletb: PHplot ao
61', Hyundai',
arul', 'Honda
'H
Carcs Rla',
Tata', Kla' M
Skoda', 'Mahlrda, Renalt',
5, A6|
þroduckon aa,a.5, 36, 5.5, 45, 1·a, 83, .9, b.

Rousteastd
plt. seater(cares, producion)
tore ead, cor, prod
plt. annoBate (yeat ,
(cor, prod);

pt. alalocL ("yeans ")


ptylabel (' produoior lo thousands)
plt:shoot)

93) a)
dot-poodutk (v: Vortore w:Vethon) voiny
asset inotante ( @, (ent, toat S)
instantt ( w,lent, kioat
nert on (v) : :lonlw)
dot -paodul eCleo(v):
ronge
dol- poduck 4 V ]* wr]
rtotunn dot- poodutt

(b) Vector) Vector ;


det Conpontnt- uois -muan(x:
V_longt : Ien (a[o)
bor lon(v)= v-legt: ghoutd be
Vauear( veeton
Samo")

1944a4veto

meart : v[?]
I/-denlz)
teturen

0J,[o, 1,0],[o,0,1]]
IIu,o,
olo makematniy (num-ows,
matnl : 11

(nusn-ob)
Kongeln
tlow- dato
matrix. Qppend(rtaw do1a)
HOturto matrela

matheia= mako -matnlx ( 3,3, Jornb do i,?:1 5

prcint matala .

covonlana(o,4): Zei-)x4e-9
hoursmovle l10, 12, 14, 8 7
hous lusp: L40, 4e, 56, 32]
10412+1418 =11

40448+Sb132
4y meon():

(-1)(-4)+(D)1 (3) (12)1(-3)(2)

(ovaianw
= rtSD•,007

(a) z(a-a' 9.5 8 1 .


lb416+ 144+144
n 3
(b) rom Strath.tinean - alqoln a irmpoat cat
tovarante ( houus mov ie

amert lenhours- mnie) = len(ours sloep)


slup))
Re teren dot (de~mean (houeimouie) ole-mean(heus-
/(Onalhourts -mone)-1)

dot tontelatlon( hm, he) aat:


Stdev-= Standand- devlaton (h)
Btondar- do wlatfon ( hi)

rteHurn Conarianu (hm, he)dcloy-asteevy

() oVarianee measues how two nariaales tande


rtom thu means.
means no u
eovonlante
Corola ioo 9eesents Uhe rengta and diucton b
the linean relatonohip

a3)a) from colluctors impont


Counte

car,Bon', dog 'cat'


animals ' cat', 4au,'dog'
dos''cal','cow', 'cat!
Countenlaninale)
anmal- count :
common()LO
animal- tount.Meat-
leeq smede
appears madey tms)
print," Mods i keeq3
P-A-tauanable -Otome-h
p

P(e)4): PlBA P(8)


P(A) P(AD
P(B,L)
P(L) p)

reando)
mport enum,
cla KPotenum. tnun):

Ko :
random - Kld( ’ B0Y, Kiol. 6;1R3)
Kandon. Chote ([Kid.
returtO

rtandon. leed (0)


tange(10000D:
Kanclom-kiC)

oth-glrst1:1
t 1.

potint ("p(e|A) : bon -gia) oldon-g't)

Import mah
= math -9qrt (a* math'p)
det noenal ph(2:Heat, mu: gtoat :0, eigma: Hoat 1)-’oat
FCOtunn (mam-txpl-(a-mu)+*a|a| maa)/ (sQR1*

impornt matploto Pyplat ao plt


n a,-,
plt at(s, [nonnl- pay (*,sg ma -1) jor
labcl 'mu-0 , s'gma:s)

laleel 'muz-), siq ma 1 )

ptsh0u) (

You might also like