Modu -03
Vtnetion Collt
rsable cod
fetion bloct
Hhat pafoma a specifie ta.
Fettow helo in beakmo don
comple proqram, wo
mangeasle nmoolare n k
3- ty pu -
dilt -in tutlon
uese the Predetinud Loole
Owailable for wwe
yemçlilyad ditiouau
out
coce
rquiing
wea- def med fuuen=
Tnes e e
dufinad hy the we
hich a the
are ed
Speti task.
pgoming
Snal, wine
amd denotd by Lambda tuyoord
fython ution
fneion dy keyword
the fuion Parentuu
d guntbn= namu lp ara met)
st }eibnbody
tn rt
Pånt "Helo
D[e Hello, welome to python
prgrang!
nith pauamitn
ymtion Lan aept th
paamete llow you to pous the
data to the
at dy edd- mbey Ca, b)
TeSt atb
Prent ("The snm s:ruult)
oudldnwnbs ( 0,5)
puenuis
paam rqd the 3
Nane 2
a
tuetn
detine to MSe 1..
adeig
Adding
50
rt) iroduut
s:
9,nunbm
5) mlipty Tuutt
npy day
in
ed fs
Vaable
stalMenti tun
Tuese
rale
withtumetion
valer rntun ith tion
luite
in lucle salenent
y get (name ):
)
Print
Pint (gtt ('atiu"))
Hello, AL eI
fs
tetion an Pyrho n
Aei atble cole tuat pufo
tas
- name paaitu):
etun e t
ejtisn
0)code wu
nese the
allw to
metiple times wethont
Sane Lode
y gret nenu:
rnt
mocluley
fumetion help olinice compl
Pro blems mo Snal, mageb
pius
clelate_aaC enath, otoLt)
poomenllngt
nioth):
e)ámprowd nacability +
by giing tuntins desaps
the pol buomes lare o
unolerstam
ren
anoidig redundany
eennat the need tn
uetiow
sepetulw code
relln 1
tuwn n" jautoual (n-)
epdatigafuction nptagdos
ode nmantamee
Calid, sfmpgy
ocal ond qtobal &ope
oal scopu
A variable oleelaud inice a
saiol bo han local
Sope
Ca Ondy bebe acLeyel
nilhin Mat
outi it
two nembt la,b),3
de< Qtb
P'Ant ("Inide the t u e ,Snmlti .
Smn.r )
Sm nbex
- nmbex (iO,20)
Taie the 4met m-rlt 30
global sLope
A vauabe delareel buide aruy
to
tmesn
Can be acceeol
global scope
he te program, medy
thioagnont
Umicle
smtuuonemb a,b)
gobal mnn-eeeet
& r u i t z atb
thefein, m t :
Print ( Zaeicle m relt)
Snm two Mmbw ( I5,25)
SUuet)
tue we n
us e loca al vbela bleg
qlob al 2
Print Cx)
Prit.Cy)
o]P qlobal qdobal
eoc a
qlobal . wadables
Sae eLe
geobl :5.
Print ("Local : , )
Prnt lgob a
ERS I
low ext
tetn vaue
AEtun ed to
The reyoore to the Caleo
t e .value
tunttm.
Tenp 3.14t ra dus 2
netun t f
Print laea (H))
op: 50- 24
a python t u t that tateu tuuo
# wte haue at lest
emb
Roon data list 4, it2):
tor y in iot 2:
reeet z T e
Pint (ommen-daa (It, 2. 3, u,5), [i,2,3,4 .5)
Print ( co mmon -data T,2,3, 4,57,[1,7,3,1,5,1o|)
Prin fiomAo ndatal l i,2, 3,4, 5J, lG,7,3, 9,ro)))
None
Ostn STEINS
Tt
enoed ioim a
S+ 2 z "woxlo".
St 1 +
PrintC t )
Pt 21 3) ’ oP Hello Hels Hello
ngtn o< stng
me m pytnon. Can be
}).
spuial
PER
-tert "Helo, oBtA
Pint (4en text)
oP 13
text "pywhon proqanmmng
Print ( Lenl tet ))
Wj*}s alPrtlen tent))
tou to liat
A based on indts.
fostion asty
to a e s
a
qezible ay
a start ndy
eno Dolea an,ioptional atep
[tart iend : step]
String [tat
Start:: Re inder kshu The cAie begins
(iniw)
end - Me inda
dya the
the
Ine inwol stude blw eah
Chauetu.'t omitted , it de<alls
dda<ao to1
tet Hello, w0Lel :
Print (tet (o:5) ) o|P Hello
Ctert (?:3).’ o<p woled!
Print
Hello.
Pint (tect l: 5]). o le -
A imuta bulit
tmwmutatbly) mang once
staimgs A ueatd it cont Cavot be
a
chamgd moou
that seem to
Any opera
atally
teat z "Helo ".
text lo]. 'h?
not
:'str object doe
S pot tom aigmnt
trt = Hello
neo tent b.+ tea:]
PrtHt (newtt )
ole+ hetlo.
Muttine covnnenta
In pyhon, thue
ayntan tor muetine ionit
Spfic
ome otuel
itfuut approan -to eie melt'liie
CoMety
conseutii
you lan
Come t (#) to
Thi is a CO m n t
that
tacn ins begi ith
Taiphe quotzi( doc skng)
Anote cowwon Oay to add Mtie
to
)atnough hee ae deevuey memt
doutings ( doumnt
be e ay oiwwti
not
aignedto a vasa
comnent,
that
spans mnultple duiw.
tach me noll be
mehde'
tuutton tuat talle a
an but
Qod on a stuing objur dity
at leest 1
alphanemiic
chaatu and
jalle ot
"123 atpha
i'Aadnumi) Beae
isalphat) 8HAUNgAas at. est
te
iphabi
tae othuis e
(saphat)
tsdigtt0:
touse ouiue
I28456789 !
gry
ttu
retug
oteuise
jalse
stcng "nCeuie"
olp 4n Tae
isuppeas
ecutees thet
a sting
othews e
stung
is upperl)
foapae retws a
Ashitup aue choLeaetes fee otheise
&yntexi Stmn9is paeec
stg
2
Stvig isspaec)
ole:
8MJ
fs. ont tin
TMe
Mimeit chesals
&tay "2345L181
ole T e
8) is.itlei)
poplyen
Syal shing ístitlat)
STang. is tte c)a
Te