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)
25 views
Python Handwritten Notes - 1 To 2
python notes
Uploaded by
HemS nAnThu
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Python Handwritten Notes - 1 to 2 For Later
Download
Save
Save Python Handwritten Notes - 1 to 2 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
25 views
Python Handwritten Notes - 1 To 2
python notes
Uploaded by
HemS nAnThu
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Python Handwritten Notes - 1 to 2 For Later
Carousel Previous
Carousel Next
Save
Save Python Handwritten Notes - 1 to 2 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 36
Search
Fullscreen
o> | j * Pithen we & hi UNIT-4 Suteomuc tien 7e PYTHON - he level , intexpucled , intesactive and. abject ~ briented acepting language - ne a Python 7 aque Pa iy ‘ thigh level ¢ ea ig Lot ¥ Rithen B aged to be hg uses English keynens Peoquonlly phere af languages use puncte tk hos fone Ayo Conateactions than thes laoguages hl readable - gt thew atien ancl chal Pythea Sntespseted | Fthen ~ paocensc at unt need Coapile yous Pe sme by she vahew Pretes. You don't tere execubag it. Rythoa yw sotewactive t Neu ar actually Ait at a Bthon pronpt ond tatexact with wthe iatexpreter helt te naite You’ pres ia Python Bb object - Ostented * Pjtlen Beppe Object - Oxiented Able ov tech- mane # pregea.rning chet encapsulates code within objects -| HISTERY oF PYTHe | * Btn Cy developed by Guide vao Regsue | in ctke late 19808 anh eoxly 19903 at tthe | Nationa) “Research saptitute fe watke moties ee Compules Serence tn “the Nether lands » | | soclud K Pitlion js dewwved Fao aeay olles lagquages - : SmalTark , Unix | | ABC , Medula-3. © Ctt, Algol - 68, Bheiy and hex acxiptiag language + <> NEED oF PYTHON PREGRAMPIING ¢ 1. SoPbissxe Auality ¢ + Pifhea filyz 09 Meadability . crhevence and fofbose alaliby i gesevel els te epost Reva thes cleels t0 | the scripting cbse . | Rythow gs deep Auppost fos mose advanced aehsee | | Yeuse mechanisms , Auch 4s abject - oxiented posogxa- | | mening Gop) —sa Gave lopex Paductwily ® Python cole ta Aypically one: the Bice of eaunaleat Crt these 38 tap to type. less to debug cttid to one fifth ov tan Code- | | that mengs | acd texg to reavatain | sotaly , aitht “he | | of Pathe Progae alge wun yame diately, dlithen | | texgtly Coapile and — bak Beep xesurved by Some yacae’ _Apesd + | ote tals, Raster begsting PG | | ‘3. Suppest Libsavies ! | + pythea Comes tut a lage Collection of prebuill and portable Panctionality » Known she Aordad tiosagy. “ths ibsarsy puppets ar anny of application Lor text patter matching | level prog warming Hoss - te netuerk Aes pling » Pylon can be extended with both hemegease lores and a vast Calleckion of ~thisd — pasity application Auppal Aofhuse . pythons Hoe pasty olenase offess tod for website Congtinction , mumexic pregsanieg , Bexial ane dleveleprent and much ese - post access, JA+ Easy to Undegs tanel ¢ 5. | very Ingh- level language , Bithon sends * Being o which takes a lot of Ayntax- leaxning We Eeglyah , Arregs off Coding beginners. lot of Coaplexity for gow, AO fis ¥ Python aadles je very begiomen - Priendly yo thal it amags deznnner4 te focus on leasing PHPAMMNT Concepls aad vot Mave te Woxty abet top euch details, Vexy flexible + ¥ As a Aynamicelly typed Ioaguage, Python jg Wally Flecible. ahys means cece one no bewd ules 09 hoy to baniel features and you’ using differed methods, have mese fecibility solving prvblens * Python jp alse wteve fangwing of ersoys , Ao you'll Bin be able to Compile and MM Yous pregvarn eat) You Wit the pocllematie past. | 4 —— oe ce & e oe eo? 9 Pf. a ae. ML 2, Gg Lf fe. .=| APPLICATIONS of PYTHON * * che forleuiag ave the applications of Paten @ wide Yonge of. oxen’ ¢ 4. Web Appkestiens a. Desktop Applications Database Appircatiens a) 4. Web Sesmping 5 Web Mapping 6. Pata Analy 335 + dabesoetwe web vspuatieation \ 8. Computes vision far ierage and Video pocessing | a Object Oriented Peg vortmveg z>| PYTHON SDENTIFIERS : x A Pythen sdeatihes pe a vasiable, Raactior . claga . mnedue identi fiex Atosts with a lettey A-2 ew exe ex eve leltey, name used te identi | le ox Other objec le An az os aq Undexg cove C- Dd fenoved by undesscove and adigils Goto 9). * -te Lrnowieg axe vaming contentions for Pytken deste 1) i) clogs names Ateat vith an uppercese- letters. All | | ate idert:ress Brot with a lenereage letter. || ne — i) Stasking an ideatifier with @ Aig leading | undexgcove indicates what the idenhfew is peivates | it) Stosting an tdeatfier uith tuo leasiag undesscores | indicating a Prvoey ly private. idedfiey, | | ends with tao teailiag undexscorg, |i) ap “fe ertifer aly | | 2 alefined Apecial Marne. | tthe identiftor woe langues | | >! PYTHON KEYWORDS : | * Keyuexds ase weserved words ant you Cannot use | shen a8 Conptarl ov Vasiable oF any dlev identifier Namen « EAN -the Pythen Kegusonbs Conary lowesage letters ony. oe eee aget del pany impat oy | fow | in pass break | eli? clogs | ese | Leon \ pret | with —|— eee sete | : que | except | | was Continue PE global lambda. | aygze | Yield | one PMH MMM anMRAnnre LOPPRPPPPRODOD=> 2 VARIABLES 7- = _ Atose voluss «hy wieans thea you creste dou egewle some pace in emery. <) * Vesiables axe rthing bat gegewed micro locations te a vasiablé, | | | j | i | | : Sgel on the a fpe of a woninble “the ies | » pretes allocates mtenmy and decides whet Can be ws Alored in be weserved memory. re a e Assigning Valugs tb Vasiables : ce Se Fythen vestiables de vot need expheit cleclaxation to * Fosenie we rion pole » the decloxetten happeos . - auto matically when gee apa? > value to a variable. oe | de cal Ayre yet se agagn vale s > . e ‘ | Vaxiables + & | . a, | 2-4 iB Aa dex gggigoneat es | bz 31a A Float @., | ag a, C+ RISE HA dloing Qi, |r gepece a 2be6 28 4 Aging Aigle velue “several Q_, : Veassiosbl ty ad + A, b,o = 15,3.12, “zise” a a, | # Assign mut: ple ohyects to ruitiple vaviables Ws | a, || | a (>) Sapur- OuTpuT : | PytHod SAPOT : i Sa Python, re have “the input() function jp alin (to take the vaputt Pree “the ser. SYNTAX + inpat C C pampt J) where prowpt B the Absing we wish t dpplas on whe even + dt y gional » £9: >>> num - input Centex nunbes:”) Entex a mumbes: 15 >>> Num 45 PYTHON cuTpuT : * do Python, we use ste print function ‘to output | gata te He shaded output device « | SYNTAX ¢ point Cotjects ; Sep! , end = ‘vn y | file = Aysrblat flush = False)Hexe a ~ , Obreck yo he Lk J as Volues ‘te be pointed. > Pp Se passtow vi used vebeen “the values . | dt defaults ato a Apece = Aflex al) valugs xe psinted , end ig printed. gt defa- chawctex. atts te a ew bine. Ls the fie yo the object there Pe values axe pital pefautt luc 36 Ayer Pdeck Saeed). | and ityé _ Seen fi | DATA TYPES K he alata stored tn mertory Can be of many lypes H Pitten as vasieys Alardasd date types “at ote ye! | to define “the opesations possivle on soem and “the Abosage metled fos each & them. | K Rythen hgs 5 Standascl dole. tipes : | | 1. Numbeys 2. stviag 3. Lisk 4 Tuple 5. Dictionary A, Aucbest - => Number data types piso aumen'© values « crested when you 9sis” > Aumbet objects abe o Value “te then. £G* numt=8 Name = * RISE” Mou can alte delele the ecfen abject by ofieg He del slotenet . wate te a numbex | | del vert (, vocal, vv3l oo, vaxal J J] | | | }> Rithen Aupposs 4 dbifheved numesica types t D tok Caryrd ihegers) i) tong C toy integers, “ey can algo be Yeptes to ectal and jeradecina!) 1D) Pleat ( Frootieg point Yel valuees) y Complex C Complex numbers) 2. Stringa ie | > Shigs 9 Biter axe Af chaxackess Represented ta the volation maxks . Pilhen adleys -for either Pars of Aingle o double Vets. \> Sabsels of Alviags can opesator CL] ead £:]) vith indexes tasting at O | | of the hing ancl atevkigg ctherw oy | in the. he granny | Prom -t at he end. i+ she plus @) Aigr 3% and the asterisk Ge) ste sen RISE! Psint st Prink sts fe] Priak Als (2.5) e te aww manner mn oaHHHHOHRAnHARAeAeaggA enteok identifica ga 4 Contiguous et be taken aging the Alice whe Along Contalenstion opesatey | Be cthe repetition operotor. # Prin Complete stsing HE Prints fiyst character of the sting Aepriny chaeacless fam a" posibien | Te Fa popitio |3 eS ———______—- ne a a Nader a Past sty [2+] # Pads Aring Abesting Seer eaten = Point sty 2 ft prods stein toe tgs 7 Psat sly + “test” =H Prvels Concatenstel shoing S gukpat : a | > | Hele RISE | H | Ilo | Ito RISE | 1 Hello RISE Heito RISE Hello RISE TesT 3g. Lists t- > Lists axe “the most vexgatile of Python's compound | date types - —> A list contasap titers sepasated by Comms and | enclosed within Aqucse vvackets (C1)- difference befaeen| ate Ainilar cto artes y Ore to a Isl fen 35 thal a thew thers belomay | | > ty | | can be of different data pe. | | | j- alt = f4, as, ‘rise’ belt = [ 5,°cse"] £g: Point — aotyt 4B Puials Complete. ist Point — atytle] 4b prints fit element of -the tt Pei abykLt3] ff pools elemeds fro aM index | pozition to 5-1 inde poaition| | Poot WELL] pray ctemedy Aerating Loon 0° | ivdex position | Pent bitte yp pros Ig tue tines Penk Olyl + bal — AE prints Cenobencted bats output: Ct Pe ie clacge| 1 | fas, *rise"] [ a5, “RISE” J [5 "ese" 5," be") (1,25, “rise”, 5, C56" J A+ Tuples t- | > A tiple tp antler ference dala type Het ys Jimilas te “the Ist, A tiple Conassts fw number | of salugs feparatel by Comngs . Unlive tabs , ples | ase enclosed waithia Pveathesis. |d is Se ——— - a + Ps > the mara difference ‘between Iyshs and tuples ant ps Liat tuple | | > | : 4. tisks axe enchysl ia |4, Tuples ase enclosed > brackets [J], a pasesttesin C). | bs R. Lysts Gan be updated. |2. eples cannot be > updated. | 3 | 7 Taplee can be —thoyght of ag read-only tyste. | . |... | patel ed 3 ataple = (4 y LS, RISE ip) | Be | stale = C5, ves0") | 3S | 3 | Pint atuple HE Priaks Gnplete Ist | Print a teple [0] H Ponts Aigt clement of “the st | Point atuplefo sa] # Poids elenors fan O* tadex position to | : -1 index poaition Print atuple[1:] # prints elements stacking fron a*t pst bluple 2 paras ibs tao position Print a tuple + brtuple H psials Condhenctted labs . out pat | 4, as, “Rse”) 1 C 1, 3s) (a5, “RISE e) (4 25) "m00") 5, vee)é Br tule 201, a5, rise”) tat ofa as, "ise" J tuple [4] = 314 ap sive Syphax with ty tat [1] = 3.19 if vali gyatex with Gat ple _ié 5. Dicti ionaty ¢ : ed Fithon’s Alwatee ase. \ike agacciative axbays os hashes Bund in Pet and consist of key fall Pais. >A dictionary Key Ga be alngst any teen fe. but are uguatty numbers 06 Ateigs . Values Can be | “y arb; trary Python dbyert « ie ~ dick ={'name's “Rise” , ‘cede’t 8 dept "ese" f | print dict (name |] Hpsiats value foy ‘name’ Key | | | | | | Print dict Ht prints Cuplete dictionaxy | Paint dict Keys C) 4 points aM he keyg, Point dict Values) Ht priny au He valucs eadpst 2 RIisé f ‘name’: “gise', ‘cede’ 8 , ‘dept’: ‘ese’ f [ ‘name', ‘code’, ‘dept’ ] [ ‘rise’, 8, ‘ese’ J ee eeOPERATORS :- ¥ Rylhon Naoguase Auppoits “the Flag tips of ope 1. Avithnetic Operates 2. Compasygon Grelatienal) operotogs 3. Assignment opesatoys 4. hegicel opexeloys a é. Bibwye opexatogs Membexghip Opexatoys F. zden dy opexeloyg 1. Avithmetic Operoboys t- Agsune acto, b= 20 “Opexstox| —— esewiption : | eeample | sp Addition Adds values 00 either side of |at Bee fH | the opexatos. | - | = Sublet Subtsachs right hacd operand Pron ee | | left hand epevand . |etutliplenkog| Ptipios values 07 either side oF aeb = 200 | fie opeetow. (7 Dvission| Pride eA hand operand by regnt | hand operand. . 1 Medalyy |Dvider Weft baad ofesond by ght howd pn 2 | | __lepewand and veturys vemaindey. | | [ek Expment Pexfoing exponential ca\culetion on Oke b= 10 | | po prea ae toe. poder ®| the olivigion of operands cdhey. a Font Diy te Meshent ee isle, Ve ea ten Hhe decimal Point axe verioved . F.0//2.0 = 410 | jb/fase | | | | fa |a. Com pax;sen Operotoys : | = these epesatoys Compare he values 07 esther sides | | | op “then and decide te elation among hen. they axe algo Called “Relational operators . | | > Agsune acto» beao | == | df the valugs of toe operands oe | (ace b) | eval hen the Condition beconex tsue+| jg not “hue [opestw| Description 7 | example $25 (oP he valugs Pf fu cpesonds axe mt (@teb) | erual fen “Re Condition becongs tue. jg tne! <> SF alge of Lue opestads axe act eral, (
Hehe value P tefl operand jp greeter Cas yy | | hen the value ef wight epewand Hen is net tue, Condition belongs tue + jor wthe value of left cpesand 5 les) Caz b) MHhan he value of ryt opewond then) ts bse LGenditien betones “Fou | {| Se af the volue of 1ePE operand 3 (as=h) | fe ’ Grecter “Hon ov cael to ee value fy nek | Bight operand pica Condition becomes tice tmue Le af the value of left operand 6 ae | ethan ox enue) “to “Be value of vg * gfesand , then Condition becomes se. |woowwe % x A Apnganed Operators: | Se aggiyo ent cperstex Bp be opecolox wped to | : value to a vewiable , | ys anee | — > Assume azto and b=ao |operates _Sescviption | Example | - = Assigns Values Peer sigh side opesyy co are assr | OHOKWHHKHMHDY eo & eevevevs be weewvusu Le eee into Cc. at adds aight operand “te whe left | gyep Valewt “ste aszatb [at subtincls ugh opetard Hoo he | gap | ofexand . iteak a: a-b ax=b at muattiphes seght operand ‘aith te | opesand aad agsiga “he veeputt te left] eahich A ene to left side cpesand. velue. of arb | | weft opewand aad agsigr the want tl which 1g enutivar |__| tePE_ operand tet epexand and agaign the Besa which jg emive~ Ite tept opewand. jteat te Bore ar akb at dwidea left opesank with he apt a/eb apevook aod again he wept to [ach ys emuiel left operand te as ask St takes reelulas ysieg toe operands and agsig? the wegart to left opewmd 4 | Podfremg expene.atia) (Power) Calculation on | a ae ofexatys and asin value to He left |uhich »B eadsvaled 4 | opevand as awh | at pedtougs Pleoe arxysion on pecan | awzb ‘and agrgn velue to Me eft operand» |akeh jx euvaled | az allb| 1 eT a ] = oa oes [eo » Losicsl Operates : o : 4 agi ypicelly ype wh Boolean [~ |> Legtenl opexstows axe. Yficelly 7 ¥ | valugs « PP ai d vesiable PP | 1% sia ‘ > Agsume variable a helS The and vi “n holds Falses | = Operatev ~ Deaceiption | Exam ple -- Yee | __ | et and | Ff both -the operands axe -twue they Ca and 2) el? leagicel ANP Condition becomes “tiie. lis pase Fal ind [oo (oy of te te qrons wwe fase ote eyicat OR | Nor-zewo ten Condition beCoresds fe eies - | tue. ~ : not Used “to weverse the toy teal Alte at (a and 8) e > Logical Ao) F i cpetund- (3 Tue sy l oe ; > 5. Bibuyse Gpenatops * , : ut ° Blaye cqeester sesly on bile and pefeons bitlyht 8 © epesot ion, © 3 | Jb: 13 2 7 =o and b > Apuce if as &o ae ofettet iE Desc siption Exanple > 2 is bit te ~the regu : =< Bins Opesotes Copies a bit te ~th sean ooad aoe 2 iP Gk exssts 10 beth operands . bzoccs 1101] SSS s apeooe 41¢0 ; eee _ @ab) = 12 al 2 H dt copigs a bit, if it exists ia either ae 0044 4400] Sg Bray OR tpesoad - b= Goto 4404 Ny ajbd041 4104 | sb) 264 citewwwu w 3 3 3 3 3 3 3 3 3 9 9 a 9 a 2 9 ? 9 [a copies “te bik, af th yy set Bi . a | MSR sa one epexard ut not both. |b = 0000 4404) Pinal eco Carb) =44 ~ dt is unasy aad Wop “the ePfect 1g —- gat 4100. {Binary one’ 4 Hee | | lcomptoned | “Phippiay” bibs. we = 1100 al | So ; wo 2-64 | < = the eft Opesonds Volue 5 moved | geed = a4’ ore lePL by he rumbex of bibs precif- manag 4444 0000 | ied by the vat operand. | | >> flee vveght operaed's value. jp woved qos pas Biaaxy ¥i i if Z ieee One ee Hy spect any e000 A444 | by whe aght opesond. 6. Membership Opexatoss : > Membership opesatoss test fev membeygmp ta & pouents, Auch lester | in | nok ia 4 Asinga, lyls ew tuples 7 | Description |evluaby “6 tue, iP tt Ray jaa faye athesnge- | 1 ee [Fiolustes te ture , if it docs nok fad % vatinble ta whe ApeciPied [Benuence and falne otherwise. Naiable im ‘fe Apecified senmence edhen ye we | | __ ef Pommente | \ Example Ice io g) pptwe! imeribes of Aeduence y- (x not in y) | ig cue, when | a ty nob oo menbell | |FF Edentiy Opesatoys ¢ nd ad opewtoys Compute ~the. memory locations of ae _Wepeniption _ false othesnse YB nok Opexatoys Precedence : Example | Evaluates to tue, if the verily (Cy iy y) is | j joa either side of he opesetor |tue , when | Feint ty the sane objects anc 1d) euualh idly) | Bvelustes te falge, if “he sewiatls Cy. js nt | on eithex side of te operetov ig hea whea | Post 5 the sane object and td(e) 18 net envsels | thine ctherajse. +e aCy) F the Biowing bie Isls an ~He operators Ror highest Pseledence to ~the leneab. Oferatox | Desemiption | i Beponeatintion (oayse -h “he poues) | [+ = Gaaplement , uansy plus and wnouy | | a 7 ring LAT Mabyly dade Medile aed Bok dloysion | t= Additin ancl subteaction He > <« [Right ard ef hase abe cree] + i | 4 | Ble anv ce Gt abage exclisive oR aed oR — antinaats }
she. if Alatement Contesys a legen expe | ysing which the data js Conporsect acd a dec-| yion js vrade bagel 00 “the vesuit of the Conpes 1 Syntax t= iP expapsion | Statements) \ Sev ESVGVYVYeoS | | | | |\= je a € Nleke do Rithon, Atedlenerds in a ble ase umifesmly indented after the 1 Ayrabel- Ed ttbsebsdddd ddd ddd Wd everve ion __“Teue- - | (|_ statewents | | =) Example : a= int Cinput Coles a value :")) be int Cpu Center b values") iPCa>b): Print C* boxgest element i: ",a) Pent C Gand aye.) oukpat : Entey a value 1 5 | Enles a velue 5 Enter b Value + 3 | Entex b Value i Laxgest element is: 5 Gook Bye. Ld | Geod dye.iP a. elge Slatements : > An elge abatement can be Combined with an iP stetement. An else Aotement Contoing bleck F Code het executey if the Conditional express? in the 1f Statement wegees to O ov a falge Value. Syntax t- if expseppion ¢ Statement (4) else; State meat(s)ean i © 2 sat Cinpat C* Enkex a value :")) pb: iat Cinput ("Ente b value t")) c if Ca>b): Print C* Laxgest number jf 3 " a) elae: pyiat C* Lagest number 381", b) ealaa Entex a value 1 5 Entex b Value + # Laxgest numbers is 1 F 3 elif Stete ment > “te elif statement attoys gee Check ra Gxprepsions fv TRUE aad execute a block of Cede 9% foon Gf One of the Condi brens evaluates te TRE. Syntax t- tiple if expressionLt | Statement(s) elif expwessionas | State mentfs) | enf exprexsions: Statenents) eve ‘stajened Ww —-DRARADADPHDDPADAHDODHHROORO|OA8H HOO OHA| foe ae houys = ink Gapat C” Entes time in hous t “y) | if Chau >= 6 and heuss
=12 and heuss < 16): Print (” Goon ArieRNeonl ”) elif ( houxg >=416 and hous <19)! print C” Goon Even”) elge ¢ pint C Goan Nieut") Oul pul: | Enter time in hous : 9 | Goon Mornina | SINGLE STATEMENT Sul TES % f fe pute of an f classe consists only of a Aage Ine, ib may go on We ane hae 99 he fen dex Arobement :Exanple:- | nund = sat Csopat Ctiker fost nutes !")) numa = iat (seput C catew gecond number! ”) | iP rund > nud : paint Gas 7 ‘ jou! sauetbes”) | yet print (mma, * is getest ee) | output ‘ Lobes osgt nubs | 5 Enkes fretond nembes 1 F 7 Leops: A loop ment of ower skstemert alleys ys te execute o shte- of Aletements enuttiple cheres . a Biter pigs language peovides “the feloving ctypet of loops * 4, while leop 2. few (le0P 3. Nested loops 4g }APRPRALALAADDAS4. hile i Statement | > A while loop latemes ta Fitton progmamenang leagnege wepeatedly executes 2 texget _Atotenedt as leg 98 a gwen Cenditien ga hae Aytar - | | | | | | | | tubile exepsegsion * slabemont(3) | Flow Diagsor I => Hese, Stlementls) may be & Avge Aratenest os a block of _Atatemens saith wamifores todent. the Gali- ction may be Onj expression - and “hue Bey tone Ze80 Value. the loop itexates cthile he Condition ja shue +a0 > wher he h becores file . progr Costes) | Popes te nthe Vine immediately foilening the loop. Exanple | nz tat Cioput (> Babes number yD fact a. jet while (heen): fack = fact & j Ve jrd PEC” Factorial ef gwen aumber js 1", fact) Output ; : Enter numbex 5 | Factosiol of ger number ig 1 120 a. fie Leop Statements + - > he Ree Siete meat ta" Python agg he ability to thewative pve “the tines of any fevuence , Zuch of a ist os a Atay. Syntax ! fev Hesating- va ta erence; Alotement@) 2a 22a aReAhAaDanaeaanan HReannannevnonenanneneeeenane &> man a Aewuence Conlaing an expsession lst, Boss evoluated fist . shen, the Fight then 10 “the fenuente ya assigned sto Be ihewating variable « Next the Atoteneds block lst 3s assigned + thewating vasiable , aad he frotements pick executed untii the enbive 3 executed . Each item ia the fenuente js exhausted. Flew Diageard ir Seauence | plac ther Poor juente- | pect Staterer¥) | 5 | Leenple ist = [ 40, 20, 907 | | for ele in aljst: | PsintCele) | alout 4 ro 30 8 iz 2 | | | | | | | | | > she bution Rauckion Gorge (> B the signt Lene - | | | ction to itexote over a Aermence of numbess + | | VangeO Genesotes an ibewatos to progseys inkesexs | Alootiag vith O upto -L BaageC) Syatare- 1, Yaage Catop) Pep + plumber of intezess to geresete,zbeabing fom zexo 2 vange( Latest] , atop (, atep) Arost + Stastieg nambex of he geruence Bop ! Genexate numbexy up to, but net including tas nunber, Atep ! Difference belueeg each numbex in~he | emuence-. AANA AAARAAR AMR ea e~mmeennw ee23 epee alyst = ( 10, 20, 30, 4.0] fos jin vange (0, len (ast): Print ( alist iJ) Outpul:: 10 20 3O 40 Using else statement with Loops! * Python Aupposty having an else Akatertent agpociated with a leop Alotenent, > OF he else statement B usec with a fas loop, the else bleck jp executed only if fox loops tex inates NowAlly Card not by en countering break Alate mont). | > Sf the eke Alatement B uged with a while loop, | the elge Aloterrent i executed when ~the Condition be Comes false| 3. Negled Loops aa Python Ptegsavorning language allews he ge of one loop ingide another loop. Nested fos loop Syatax + fos ikewaligg vow tn festuence Pow ikerating saw ia fenluence: Atotement (2) Alatenent(s) Nested while loop Syobaxt while expression while expression: Stote ment) Atatement(s) | Example! for i in Yange (0,3): for 5 in ¥aqge (% 3): Print CG, 5)) ERT geggs ARADRDRORDHHORHH ODD hi eo ji Aki PPD PPPPPP?Pgo SV eutpaks= = = ©,0) ? (o.1) SS (©,a) Se Cia BT a ¥ re > 1 90> LEER Control SrateneNTs t- a s Sg |® che lap Conteol slstemedts change “the pidion = Lom ik, noxmal geajuence 33 on B . So Ryon suppody “Re Peiloviag Casto stastenedh | atl Ss 1. break Statement ss 2. Continue Statement =o |S Pag otatenent aa _ 2 ld. beak Statement | = [> athe brenk tatement tesiniaates “the leap ee =3 | and traysfes execution to he Bettement immediately = | following ~the loop. bobuessce Example ; foy letter im ‘Python’: if Clettey 2h’): bseale Pest ( *Cunth tether + *, later)Output : Cuxtedt lettex: P Cussent lettey + y Cussent letter: t 2. Continue Stole ment the vemaindey of be bedy and immediately Betest ibs Condition pyiox to seitexating « Exonple : fox lettes in ‘python’: if Clettex 22 °h') : Continue * Point C° Cussent lettex +, letter) | output a Cassent letter Custeat letter | Cusvent lettex: Cussent letter * Custent letter + Sota y > he Continue statement Cougs te leop teats | | a a a a DRPAPARAO® aa j fh PPPPPELEoutput ; | — | at 3 pags stobement : | > The poss statement tg @ nat opexation 5 nothing | happens when tt executes - | > nvhe Pass Stotement BP ago ase in places where. | Jeux Code wil eventuaty go, but hes nol been wositten det . Example t fw lettes in ‘python’ e ‘P Clettes =< °h') * | Popa | print (* this ip paps beck) Prat (" Cussert lettey 2", letter) Cussent lettex: P Cussent letter! ¥ Cussent lettew > This iB Page block Cussent letter t h Cusvernt lettex 1 0 Cusvent letter.”
You might also like
Py QB
PDF
No ratings yet
Py QB
19 pages
Python ? Handwritten Notes
PDF
No ratings yet
Python ? Handwritten Notes
73 pages
Python Handwritten Notes 1701013067
PDF
No ratings yet
Python Handwritten Notes 1701013067
73 pages
python unit 1
PDF
No ratings yet
python unit 1
17 pages
python unit1
PDF
No ratings yet
python unit1
39 pages
Python 2022
PDF
No ratings yet
Python 2022
12 pages
Python
PDF
No ratings yet
Python
23 pages
Python Notes
PDF
No ratings yet
Python Notes
32 pages
CamScanner 12-13-2024 13.44
PDF
No ratings yet
CamScanner 12-13-2024 13.44
25 pages
Python
PDF
No ratings yet
Python
5 pages
Python Numpy Tutorial
PDF
No ratings yet
Python Numpy Tutorial
22 pages
Python question bank
PDF
No ratings yet
Python question bank
13 pages
Python
PDF
No ratings yet
Python
232 pages
Python (Assignment 1) Shubh
PDF
No ratings yet
Python (Assignment 1) Shubh
12 pages
Python Unit 1 Complete Notes
PDF
No ratings yet
Python Unit 1 Complete Notes
46 pages
1696123699200
PDF
No ratings yet
1696123699200
73 pages
Introducing Python
PDF
No ratings yet
Introducing Python
108 pages
New Doc 10-11-2023 22.03
PDF
No ratings yet
New Doc 10-11-2023 22.03
13 pages
Python Programming Notes
PDF
No ratings yet
Python Programming Notes
33 pages
Python Alok
PDF
No ratings yet
Python Alok
23 pages
Basic Python For Scientists: Pim Schellart May 27, 2010
PDF
No ratings yet
Basic Python For Scientists: Pim Schellart May 27, 2010
21 pages
Py Ass PDF
PDF
No ratings yet
Py Ass PDF
33 pages
python m 1, 2.pdf
PDF
No ratings yet
python m 1, 2.pdf
12 pages
Book Template
PDF
No ratings yet
Book Template
53 pages
Python For Data Science (Slideshare)
PDF
No ratings yet
Python For Data Science (Slideshare)
54 pages
Python Unit-1
PDF
No ratings yet
Python Unit-1
17 pages
Programming With Python PWP Tech Publication Textbook
PDF
0% (1)
Programming With Python PWP Tech Publication Textbook
40 pages
AE1205 Programming and Scientific Computing in PYTHON - April 2022 2
PDF
No ratings yet
AE1205 Programming and Scientific Computing in PYTHON - April 2022 2
222 pages
Unit 1 – Introduction and Syntax of Python
PDF
No ratings yet
Unit 1 – Introduction and Syntax of Python
11 pages
python notes
PDF
No ratings yet
python notes
25 pages
NumPy, SciPy and MatPlotLib
PDF
100% (1)
NumPy, SciPy and MatPlotLib
18 pages
Python For Mathematics Students PDF
PDF
No ratings yet
Python For Mathematics Students PDF
115 pages
Python Handwritten Notes Book?
PDF
100% (1)
Python Handwritten Notes Book?
77 pages
Complete Python Notes by Kaushal.p
PDF
No ratings yet
Complete Python Notes by Kaushal.p
77 pages
DocScanner 18 May 2023 12-40 PM
PDF
No ratings yet
DocScanner 18 May 2023 12-40 PM
18 pages
Discrete Structures Lab 1 Python Basics: 1 Python Installation 2 Python Tutorial
PDF
No ratings yet
Discrete Structures Lab 1 Python Basics: 1 Python Installation 2 Python Tutorial
8 pages
664 PythonBasics PDF
PDF
100% (1)
664 PythonBasics PDF
42 pages
Python Basics (By Mark Wickert)
PDF
No ratings yet
Python Basics (By Mark Wickert)
42 pages
Python Numpy-Github - Io
PDF
No ratings yet
Python Numpy-Github - Io
25 pages
Python For Economists
PDF
No ratings yet
Python For Economists
34 pages
SCH_BPLCK205B june.july24
PDF
No ratings yet
SCH_BPLCK205B june.july24
17 pages
python unit1
PDF
No ratings yet
python unit1
46 pages
Document
PDF
No ratings yet
Document
164 pages
Index Important
PDF
No ratings yet
Index Important
18 pages
Python @1
PDF
No ratings yet
Python @1
50 pages
2 Python
PDF
No ratings yet
2 Python
131 pages
Null 5
PDF
No ratings yet
Null 5
19 pages
The Ocean Ebook Cover-1
PDF
No ratings yet
The Ocean Ebook Cover-1
37 pages
Basics of Python
PDF
No ratings yet
Basics of Python
8 pages
Program Python Unit 1
PDF
No ratings yet
Program Python Unit 1
11 pages
Fluent Python Luciano Ramalho pdf download
PDF
100% (2)
Fluent Python Luciano Ramalho pdf download
38 pages
Python
PDF
No ratings yet
Python
13 pages
C Programming Written Notes 1 Pages 1
PDF
No ratings yet
C Programming Written Notes 1 Pages 1
100 pages
Advance Python
PDF
No ratings yet
Advance Python
10 pages
PYTHON
PDF
No ratings yet
PYTHON
22 pages
Python Note
PDF
No ratings yet
Python Note
83 pages
Prem Ass 2 Python
PDF
No ratings yet
Prem Ass 2 Python
8 pages
Introduction To Python: 6th School On LHC Physics
PDF
No ratings yet
Introduction To Python: 6th School On LHC Physics
24 pages
python_data_Science_05_06_23 (24)
PDF
No ratings yet
python_data_Science_05_06_23 (24)
62 pages