Professional Documents
Culture Documents
Cs Chap Working With Function
Cs Chap Working With Function
25Jumy 2022
borkingwith
iunclions
*tundiomA mctim ud aubpHDghom that iadta an
data amd a n hutunma a value.
h m a tunpitonid uaaam o waunetiona iuo ita mak
pxngnan homdling a h vao umy a wnall pant o
tt pogham uo dialt uwth sat a tim.
Auathn utaamn to ual mefom ua h udu prograsm
Ai umetioms vmakL a puogram mbn yuadablt' and
wmdnatM.dable cto ua progammn
ww.tia pLa
But wn wctims TuAL van p-duginid whanm and
aluoaus awailakl u s . ihane vMaud a m
d tum
lik-un) , type l), int , imput U) Lt
2 Fuwctian diiud im aunduls ThuaL
wchins uanL pudified
n pahtiulah umodulis samd cam aly hi uoLd
uhm thu.
COHLApmdimumedl ia impeetrd
ea 1fuwamt do Hual tu squani neatof numbn
ThM amy
kaut to tmpd/t umath modulu
dnnd metiom Tua tau deinad by dihe pregrammer
bestfriend
Date
Page
return
Funchim Lallwil
Laat atimnddthu fuctim diisttin
Fmaim i l ud t wtro back to uaun
t mhm was _callud.
fuchmdahin
func
print ..)
bestfriernr
Date
Pag
Ex def calcsum(x,y):
retums Fanamdfer
print (calcsum(2, 3))
b 6 angumwts
print calc.Suma,b)
pri (calcsun(1,4)
Paaig asamters i
ethn pkyidis 3 APLA o mal anqumala paramatrs:
1Peaitianal anguwnwt tuinnd angumuuta):: wwm thu twwctia-
call atatluiud mwt wmatelh ithL mumaw amd
arodin ot
cthoumets ad d d um th mcion diinitn hia
incallud dhu pttion angumd matchig.
Tua s thrng auch fikoenim call,
2 th angumud uat be povidad far alU panamtoa.
2th valls a angumwAA ankMatohed awith
pahamuters,
soien (adusy n LPasi'tional)
bestfriend
Pago
*singsuhpleanguuttipp daqthn
Rtham allous wa uto cambime multiple angumud
ubpes um va wnchion icall
Rulua pr uombiuma alU thau tpes aaumuMA
am
anaummmt ist mwat inar Ketaimpaitima
araumaa lbuucd byamy kwrd anqunumt
Kujuard angumeta aheuld sku takan im thu nuquinsd
anummeto ptchably.
Yn Comnat sptciky a Nalua om 10ngumnI
w.ai hom oueL
Scope of Variables i
Pavaaprag ramwifhin uluuh a maMnA ua
Jgal ad
1Global Scope i
A mamas ducland um p u l aLgment
(-main--d
a pungram us Asid ido haue aglobal
spope omd us
uwAabl inaidL t i adhdL pungrann amd all
hlecks_
cohtoinsd uoithimfhe pungram
2 Local Scope
A mamL dielansd un va mctim- body uo Aaid tr hau-
Uocal ocope i.e.9 it com be uad anlywithun tha
metion Omd dhe othu blocks
wntanidwmdn it
aabua dikind souteidi all humcthiona an
qlobal variak-
X 5
def func(a) Yaviabl difimd above
oa
qllfunetions
be at1 Eis also a global Vai able alang wn
amd Uz
Feturnb
yitpur (nEnter Numh")
2=+funlx)
print(z)S
Ye Page.bestfriend
Date