0% found this document useful (0 votes)
4 views7 pages

Functions Notes

The document discusses programming concepts related to functions, including naming conventions, argument passing, and the distinction between local and global scope. It emphasizes the importance of function headers and the correct usage of positional and keyword arguments. Additionally, it covers return values and the handling of mutable data types within functions.

Uploaded by

rohitpatra708024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views7 pages

Functions Notes

The document discusses programming concepts related to functions, including naming conventions, argument passing, and the distinction between local and global scope. It emphasizes the importance of function headers and the correct usage of positional and keyword arguments. Additionally, it covers return values and the handling of mutable data types within functions.

Uploaded by

rohitpatra708024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

MT W T

Page No.:
YOUVA
Date:

Jundien
a sub; prcqlar Hhad hay a hcadin Qhd
a tunc. body. Ct mak, he proglam Pasie) to yad
molmore YCad able) l redues the aize o the, program
tSungtax
helps inehosreuhesalbility oihe
comr eaich
cod, tadung brang logcalz
defotef ido
identiier -

Body
herdioa s) Fane. cetl

Rule, to naming atunc.


ave tunca Vay namey ave both jdenhles:
anahare alghabeh Ag a,09 2 .
)ant stayt a he digit.
*assing data t a tuectian Tke dalo i paued to tha
funotion oithnoud by a kets. The dada pautd sme called
ah avgumend pavanto.
Ln atune call, we can pay a const.,Var expein

dlfoo for fune


MT W
Page Not
ormad av qu-ed /pavantlo. Date:
YOUVA

(an only be var Ots a placeksldey.

2 y

5 tde
aly cdy
e askea
agan
L aduet pavamulrl argumee (an be vav, (onsl, rplession s

Alto t iny of func tocw of contml goe, to he nert


NOTE Fa True and alse uhe ued in a
algchale epyesions itwill chter ayeits int Val(Lo

alvald
fadbn-2)
nlzls
Tun ctu
ietuming alalu
kAfune nay or may not setun a udd to the main.

(ontyol badk to main beaks túnc


toca When otune retusns c val thet are Saly
ways to call it
M T WTF S S
Page No..C2 YOUVA
Date:

Yekums yae Jone by delault


XAL Ah tune hich vetun Non are knows a
Voicl or non fruttul funelion
*Al Aha, fune hich retun aval. aye knedn as

det add la b)&


C=0+b

Locad and Glooal Scope


KA| he ploqramming lines wloat an de ae DYeset
ilobel'spas o ar ea and coms wnder the aloba
SCop.
* AlL Ahe her o an id indent form local Scopc.
Ahyeoo Vay delined in the local scope
i not he available n Hhe globad spae.Auytang dan
ntune Cannot he 0cessed outsike be cusa "atc
fom the memory
M W T

Page No. D
YOUVA
Date:

Retum state nend


ekuea05 jll ony efutn 2s buythy
ekunlaote) exe cubed
Habiple retuns

Od

xetun atbto Brackcts aue optiouel

azb
data into
otuple

A ehun can vefun multiple val. uhih will be


Yehuned 0a tule.
A23) Cives TypeEror
('n
oindl porans,
MT
Page No.;
YOUVA
Date:

fassing mubable iomatable datatupea 1o0 tunc


def fa OTPOT:

Vp- 34,5
Dnt

Awhey a mutable datatype s pasçed to a


maka o pad hage (change to, any Parto
Angl Va)4hen any change ma de by he ttte unc. is
NeHlected in the
a behaus like a"main jar presend in globa ae.
vetevenu top o l

n(a)

3951
np
p
l
a obcet s ysighed toavak
Thena ne Nar
Nar a.kalocal lar.) &va, in hain a Ca i los
MTW TF SS
Page No.:
YOUVA
Date:

Fucttan tatt Func. headtng


0
del aub arqumtt

fure
Ihese avg. aye reçeived i the tuc header 04 per the

addlog a tokg val.ot ylb take val of.


OUTPUT:

lend donot e matta


T keg keyugrd glyen should exatly match Hhe speling
Hfune header
M S S

Page No.;
YOUVA
Date:

def add (a.b)


piat latb)
Gdbeloa3)0) ’a ake val of99 btakes val. of lo
30
larg Cano be Qven mull iple val in afunc call
mutile
For eX addl lo A=20) woud Yaise a elroy as a is teng
assigned OA20.
Whon keg kty word &postienal aiqumerd an gile togelbo,
Ahe ue stat that Ahe poshiunal avg. hato be qiven
ys follqucd by the ker keyibard am o ture Cato
add (1o.be)/
addlooX

aI02030
add 2 , . 6 o
addx2bx)so
Add(a X 2./) Syhtaukrar pesitiend arguam oid follow leeyood agument
addllio:y 20he2)

You might also like