Fundamental of Data Structure
Fundamental of Data Structure
CREATING AN ARRAY
A aray in python can be Ceattd by-
mpoz hn9 oXTo module (dcrta,type valuelist)
J
S Utd to Coeart an ox h data t9e
gnd uoalue list SpeciEied in tS o8gument
b = an gTsay d 253,2 33
PrinC The ne e s t daT3q is )
| BASICOPERATION
tolloong Cgene basic Opeac1honsSuppo teo by an
FUNCTLONS N DYTHON
A Funcion iS a_set OF Stale mentS tha t
tke
in puts do Some Spe ck c Computahon and -
pIoduCe Outpu The cdea 1S 4O pU Som e
Commanly OS epeak dl done task oaethe _
and naake a um ion. So hdt insBeao of rhng
ne Same Code again and oaaunfr dipfese
inputs Can Call tne Funchonspudaan põ0vido
built in_ Funchio os ike pointO,e c bu+
we can alS o CTeate uour Own FunChon s
These Funchons aTeCcilied uSer Func hor.
evenco dd)
FOR LOoP-
For laop ase wed FoT Secuahia
Hsavesal Fo es raues Sina a List o
Shrina 01 aYay etc In python heeS no
CsAye Fos \OOP e FoT (i=oicn\tA)Th e
For OOp in Python S weo tos e a t e
Obect s
TeTahing
ngovex a Sequenee is Called tsayeTsal,
Syntax OF fo loop
F o val In_Sequone
Bodu OF Tor
Hese Val s var iable hat ak e s h e
Jalue Of he ite m inside he Sequen Ce on
eaLch ites ahion loop Conhhou sUnn ) _we
ech
FOR EACH TEM IN E QUENCE
LAS+ ES
TIEM
RE ACH
NO
QoDY OF CO_
EXIT l0o p
e a of Eox loop
Lis aF numberS
DumbSL6,5 3,2.42,5, u
t Variab)ee Ovez AhR 1is
SvmE 0
OP Tas Sum _ u3