Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
19 views
12 pages
Functions Notes
j
Uploaded by
mukilsanjey12
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save Functions_notes For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
19 views
12 pages
Functions Notes
j
Uploaded by
mukilsanjey12
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save Functions_notes For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 12
Search
Fullscreen
fee FUNCTIONS’ Funchons ts a Glock code which runs an when i ts called. ailise Reyword ‘def” to defiie or declaw function. sunt (4,0): f pron (at6) Sun(2,3) wo LG flae Sum is bey collet & ctecute prick statement: ee types of funnhare, ee pytion finctions: dotr>. split,
appadO cke.. © Guilt: ie modules: traport. vaiedonn, prt slatistis, pike 6 User-defireat funclions: The fnchions which are not builtin but defined. by users. eel C) = prot Hello Word) gyeehO) + tlello World Gna) | 4 lit wanna. get ith a SLT’ name) | e'Kvogpat) The above ode portrays fow Furchons | cllgeC Kanye?) eay Ge use 6 rede a. ake colltge (pelt) ~ © scanned with OKEN Scanner|ctuctwe of @ User-defined junctions. é > (parameters) julio bole i > Cp ft A < fonction Gody > Cretan pert ne cfnc-nae> CRogpoens?) | 2 pada fore: The above fnchion. works only when. furchion ts alle. ba fhe named variable folds variable [accepts values. (formal penal ( (formal a a - follows rules of ident Arguments: Tie oe wis whee gives ceput to inte B ryote): _—-‘Aeval porareters) a mem rate) feluol argument wae i Payal Iopanas ve fe be declared proper postin in uy ya rie ined ) prod (sums, 12,50) © scanned with OKEN Scanneruments Soramelers: a poramelers ie which the values ars asincd 1 parele whe dedarng fincin-hender sume (a,b: c2 5)* prott(asbtc] sum (2.3) #0 Swne(2, 3:4) #49 G u will ovewnite sum(a,b=5) C=6): pratt (a+b +c) sumec2) #0 gune(i3) ll Nove: Default par amettis necot not Ge declareol in fonchion call. § Tele it will Ge overwritten. sum(ars, G1, CF 23): prick Carbec) sum) #4 def sum (ass, 6.0)! prick Casbec) 4 ror because °C’ tS rot feared. gw(2.3) Cit doesn't follows rules) iN © scanned with OKEN Scanner§ sync (213 92 + Error. beause tb doesn't plows ee declaration A default porayieter’ shoul not Ge declareol be A defa cee efte Yon- por > Hore, a U3, declared before G which non-default. def gun( a, b=, c-6) df sum(a=5, 625.0810, LIA def sum (a5, 6, C2 to, d) X word rowentts: t value qiven b a parancler ie fonchion. coll fe def abot ( sd chulent 2, studort 3) : print (Mey ‘favourite ctudent is’, student?) ethonk (‘Ner’, Bob’, ‘Chales') HMy farorite student is Bob. School ( student2 = ‘Bob’, student! = # Ny favorite dent 14 £06 / Sore: Soy nee order doesrtt matter f every pooanelor fos ipt fult value. | def svmCay6c): print arbre) Sum Ls3,c25) 410 cum 23,025) # eror(a has two values) : sun( 2.6235) 4 enor (Beyword argument declorek allegra flex’, student 3=' Gales’) 4 © scanned with OKEN Scannerf Values Cusing rebum shaternent) , Retun: This will store te result of the igalican will retrieve output when furchion Us > Tes ts nd of execution. fu: 2 (2,6): 1 def S sunt Caio): 4 shart Garb) prt (ato) prok(sumce 5° |-pri- sumct3) HS as sum(G 5) i ar aus) Hil prckle) atu pride) Hflone @ Reburuing Somelfung lon voidl) @ Nor Rebuy Wid) def Suy (ab): | sum (2 pone —+ Nlon- void te Statement bef sum(a,b): sum(23) thi. © scanned with OKEN Scanneran of eee AO APRIET eA pees | 9 def aun (a) gearb b return § Fai lt oy tame Dz wt vital a wanber: 2 a dike wit er rummber: ")) Hite outtsiole of a. 3 = snl Ma? bd (The sum of two quombers ts: ”., add, function) ttlawelor vst ity Fae ae Scope of variables: How & gariable can be accessed insidel otterde a fuuction. The. variable whith 1s dedased inside the fiction foal ee fas al sope 12 oleh 08 (cal variable. f table cout be aceened odside the function oa snp» les which ave declared outside te Gide pe» i yn et call as Gobel arabe of global yortable. an be acces, aiynlon i 0 praia ( nse ota the Fo In). » focal var © scanned with OKEN Scanner” def divisor O a5 Ls (ual voreables 6-6 (arb) — carte accessed tnaide a. fine tine at G1 hal variables : pre division C) pro(od) 9 yea : 1 15 \ def sum): ( (obal, azlo | prixtto) sun) = Flo print) #10 SH mokes ‘a’ a global ase © scanned with OKEN Scannera B) chack HL WOK, locolal er» WE ned bo-veverse He (2S gut tum. Aahwe YevNumber (um: YWE0 MNO, Whi Wn? 0: tem =F HOMY 10 TENE YeV® wo yyern hum = Num {Ito - AUN Ye aint (sever (42343) BL dah erWunteer (nod + i Xe YM =0 joohit NUM IO; i em enum 10 : IN = YeV* Wot 40m j hun = purnl| VO CHIN orev pit (yeaNoonber(1254)) © scanned with OKEN Scanner@) vsti a fue poystnow CPLACES) im pylon, drat dake QM) yu dlickionary PLACES Os On argument andl cliplays dhe womls(in ppor cane) of tre plows whore pare acre Ameer hon Scharachers « For exomnple, gomaiber th Aaloving dichsay own {ys “puted” aod, afar, 4s SNewpatk 6: ae} ". 2S Leb» GauundkNows (PLACES): thre % Jon Crurnces) 7S: peers DOT = PLACES “URED Wegk » rink (ovT) : "9 “git he counk ® by tan saat) deh Counknew (PLi/ PLACES) # Ape tin PLACES": if aes CD22, print (1) ug per 0) 8) writt fu’ Ln Words (string) , Yhoks doko ashing ad an argumot frdurnd & buble coming Ung uf gouh wvorch of ashi Fos entry, Hf Yh shing ® Wopme We uD have Pars fo Ye Aug will have (4,3, 2)4)4,) © scanned with OKEN Scannerfs dah, (woWotds (STRING) : % for Lin (STRING) OC = Muple (split STRING) pont ( oe 4 4 tonwords (eraiigy: et. Age ihe STRING, split) ; ] : fc tiny have We donk wnt te wut t=() divecty in lin a - emia ‘. } tious tiple doo PIINKCA), Faive oppendl fortes fugle In jrnrudable pe dh fortWorda (STRING) * ces t-C) o. Le STRING « split) Aes tml: t= tt (nc, print (+) © scanned with OKEN Scanner8) ait aft TNDER—UST(ED, whure L is de lat coment porsd an onqurant of he fin’, ‘thy fur’ rebures anolter tat rains Sinden lat” frac shoves dhe jadivts of ok rn-70r0. elven fer tinrmple: if L contd (12,4)0,11,0,56 The indorbit will have - [oy1, 35] e | a dh WOES UST (L): d ‘edeabak= C) » frome nes | wp » fbeor wget te “appeal paint > » u wy ‘INDEX-LIST + 4 indian f= {J ri dint: Ife = =O? indtalisk « dqqudkL-indax(id) print Cindsalist) © scanned with OKEN Scannerye ~ dah, INDEX LIT): nd ist fork in voroe (laf) | WLLL: BON anaes ndexfist) 8) Wedik Ye ovkpuk: Ves dh gum(A=2) : qotall ° eee prin (R, end=“) a= {0 b-5 Sum (080) Olp= [054 6H Sun (15,421) et © scanned with OKEN Scanner
You might also like
Python Notes 2
PDF
No ratings yet
Python Notes 2
38 pages
SCH - BPLCK205B June - July24
PDF
No ratings yet
SCH - BPLCK205B June - July24
17 pages
Problem Solving and Python Programming
PDF
No ratings yet
Problem Solving and Python Programming
34 pages
Working With Functions Xii Output Questions
PDF
50% (2)
Working With Functions Xii Output Questions
7 pages
Python Journal
PDF
No ratings yet
Python Journal
25 pages
Python Fundamental Review - HTNM
PDF
No ratings yet
Python Fundamental Review - HTNM
55 pages
CS ch-2
PDF
No ratings yet
CS ch-2
14 pages
Function
PDF
No ratings yet
Function
25 pages
Pyth Assignment
PDF
No ratings yet
Pyth Assignment
27 pages
Python 2
PDF
No ratings yet
Python 2
25 pages
Adobe Scan 24 May 2022
PDF
No ratings yet
Adobe Scan 24 May 2022
13 pages
Practice Makes Python (Reuven M. Lerner, PHD) (Z-Library)
PDF
No ratings yet
Practice Makes Python (Reuven M. Lerner, PHD) (Z-Library)
159 pages
Py Tutorial 29 56
PDF
No ratings yet
Py Tutorial 29 56
28 pages
Python Notes
PDF
No ratings yet
Python Notes
49 pages
Mid-I Assignment
PDF
No ratings yet
Mid-I Assignment
17 pages
Python Practical 6-11
PDF
No ratings yet
Python Practical 6-11
15 pages
Lab Practice 1
PDF
No ratings yet
Lab Practice 1
13 pages
Notes On Function and Modules
PDF
No ratings yet
Notes On Function and Modules
24 pages
Python Record - 4
PDF
No ratings yet
Python Record - 4
29 pages
الوحدة الخامسة - الدوائر التجميعية
PDF
No ratings yet
الوحدة الخامسة - الدوائر التجميعية
30 pages
Class 12 Cs Practica
PDF
No ratings yet
Class 12 Cs Practica
53 pages
Mad Study Question Bank
PDF
No ratings yet
Mad Study Question Bank
12 pages
Basic Handnote of CSE-101 Course
PDF
No ratings yet
Basic Handnote of CSE-101 Course
43 pages
Python Programs
PDF
No ratings yet
Python Programs
25 pages
Python Assignment 3
PDF
No ratings yet
Python Assignment 3
9 pages
Python Notes Handwritten
PDF
No ratings yet
Python Notes Handwritten
25 pages
C++ Unit 2
PDF
No ratings yet
C++ Unit 2
46 pages
Notesof C Language by Abhay Kumar Awasthi Till Recursion
PDF
No ratings yet
Notesof C Language by Abhay Kumar Awasthi Till Recursion
27 pages
Mcs 11
PDF
No ratings yet
Mcs 11
19 pages
Python Handwritten Notes 1701013067
PDF
No ratings yet
Python Handwritten Notes 1701013067
73 pages
Python ? Handwritten Notes
PDF
No ratings yet
Python ? Handwritten Notes
73 pages
Python Unit 1
PDF
No ratings yet
Python Unit 1
21 pages
BCP Ab
PDF
No ratings yet
BCP Ab
65 pages
Functions With Questions Part 2
PDF
No ratings yet
Functions With Questions Part 2
11 pages
Dec 13, Doc 1
PDF
No ratings yet
Dec 13, Doc 1
28 pages
Computer Science Notes
PDF
No ratings yet
Computer Science Notes
36 pages
Python Notes
PDF
No ratings yet
Python Notes
25 pages
72fb2675-6290-4c54-b10f-a9d2d59c8230
PDF
No ratings yet
72fb2675-6290-4c54-b10f-a9d2d59c8230
22 pages
Cs Notes
PDF
No ratings yet
Cs Notes
28 pages
New Doc 02-22-2024 23.56
PDF
No ratings yet
New Doc 02-22-2024 23.56
27 pages
Python Imp Question
PDF
No ratings yet
Python Imp Question
17 pages
Pyton Notes 2
PDF
No ratings yet
Pyton Notes 2
29 pages
Python Assignment 2
PDF
No ratings yet
Python Assignment 2
12 pages
Python Alok
PDF
No ratings yet
Python Alok
23 pages
Python Unit-1
PDF
No ratings yet
Python Unit-1
17 pages
Odd Sem Solution
PDF
No ratings yet
Odd Sem Solution
11 pages
Module 2 Part 1
PDF
No ratings yet
Module 2 Part 1
13 pages
Cheat Sheet
PDF
No ratings yet
Cheat Sheet
2 pages
CS WORK 26-Oct
PDF
No ratings yet
CS WORK 26-Oct
11 pages
Computer Science Practical Amit Bikram Mishra Class Xii Science A
PDF
No ratings yet
Computer Science Practical Amit Bikram Mishra Class Xii Science A
18 pages
Predictive Parser
PDF
No ratings yet
Predictive Parser
17 pages
171
PDF
No ratings yet
171
16 pages
Py QB
PDF
No ratings yet
Py QB
19 pages
DSC Notes Module 1
PDF
No ratings yet
DSC Notes Module 1
56 pages
Python QR
PDF
No ratings yet
Python QR
2 pages
PDF Scanner-07 - 03 - 2025-04 - 36 - 47
PDF
No ratings yet
PDF Scanner-07 - 03 - 2025-04 - 36 - 47
48 pages
C
PDF
No ratings yet
C
25 pages
Python-Unit-4 R16
PDF
No ratings yet
Python-Unit-4 R16
18 pages