You are on page 1of 285
PYTHON PROGRAMMING Brief Contents Detailed Contents Liem 1 tarde Comptes and r FiemSohianSiraape 1 110 Cmatcaing Ue (CPU Base tps fap) i” Ut elec stney {Goes ?— Png Rofo mae a 132 Py Mey BI ren ronnming cnt connor RL aS NSRANTTETAT) core Coron ben so usasitine omen 0 4 ett tear a ape a ‘ye acs 202 sus Pedra eee meat = Tang oD 130 33 toca See cucu ia 4 echo Cnr Stent 137 in ti Erin ae etl a mien eer eee Me 1a ee gg Seeing gL 5 mee 38 pO "7 ately 4? 14 Opie Ce 282 2 Foran SH SMS ety or 26 Tat Tepe enn 2 Soe et re ee Ay telerhene {LM Indaion pyres eptateet 15 Reng and Witmg Files 295 3h Geta 9 wer rn TNO 2st acme, eRe asian ea! — saben!” Renin Cora ge eran oe a a re techn Sateen,

ay deacon en nie toe ca BY rer roomnne 1.121 Memory Hierarchy tpn rey a don same py DRA Dani AM) ache Memory ‘el ene he rman Sermons sary cong Fgura 1.21 Mary ay Wore te Gace any ee igi ae CP nat a 1.122 Primary Memory "ime ra ey ha ey) dc acd e he sty he CF rab eit Ts a 9p apy ry RAM ed KO, a adn ees Memory AM) igemeeuenymeeernne mneateess Sais peeamee enero Hae eee aaa seeeateereaee mato poem tome epee acto pam creat centre alice ren See Sommerer tr out to te SORAM (OOF) ODI aos a scab ering afin the eee Se ieenen ce caeceaa erect A an cert hgh bs set. Alugh DR as wie the atncy a aces dey) of DDR pecs erececmenoes Be laste sat eae races Se nea Boece cing it a ae A, 2 mea Si icra mmr hart nol by BD ree rogamaing “ane opty ua nora emay *amaestne wa rear | Oi ont ne teen “Tegenamecpanatty way smi sg spe: Sere i tte Ox Oy, Ro uy nr pe Oe ‘soo pun Honey ROM io a a opt sr i OR Oy + Pome mer PROM tad one epee ROM wie ‘grad Thc PROM cae aly expiant py Bene ent nse gn a nh 1123 Secondary Storage Devices |U13 CLASSIFICATION OF COMPUTER SOFTWARE Enc ree aocaa a cicrciearal pipe weaves eros rey SE ‘etn ts TL th Sete re pe Raseeccrnnmanis tect a ae naia cess BY) rye reranning ern reesy iningrtomsstawelnsenpnnd i |g con panei “Cmene noua anion ncpowry oer | Earp sen Wr Meat Pa 1.181 Sytem Software seit apd Sse eh hd iia ontemmn ine Sarre ee TT ferences Og | ae Se ie fate ci in rn te eee Bt apn cn wad pf 2) Pron reaming noc mut pc ut cane es oa aren trae, ‘ocho ding eon ssn tv cin ea, pring ol malig Se ecto nk ni ti mf oe Crrmenm ier aenctn mtb Commend i tC roi a (Le le ett peng areal fian)) aN Basa aceasta dln oe foes hinge seal eisai ars alia Beggar eerie er cmatichaee Bin sronakias wa ieen oat tecy chon nee filowig enna ered “Th os at ei if enced ep ofr pi tig To Igri et be Tres ass by en rn ee fn ony et wing ot mara en tii ts lange nafs Thane op errno tat nd Raa rant ovat eg noite ‘Sages Chr tors sm Hence Exon ss nh ps ph pn a + te SQ est signer HU "SEE at anes Sp bute ay me se oe ges Te + Vag Tipe Qe" "5 Yo cy mii ng ig peas Yuc ea ‘ane uc ure ont ae “tampa usr magne Be Wen 0 pit este ig ce Eh wl a ig pt a a he sm ns iia eh “eaten si wien epee in ert orc sing pete i ue aap aspen No aie of ay eh op ing et a all ig mb Te Frag casoy ever erm Escape sequences Srna mth dices ng Sher mt cyl esa ce hen empha ates wpe BED) ren rooming SOREN TARE a ees S55 AT ante TGS) Jy ute vrei ab os nT 8 Aa Hd ne ‘vets ‘Tats Set ncparots y ‘oy pie A MAA BY ctu vcn ging tin fg (th ede lle inne sa tng tiene te ad eer orem o> rg a aba a parle ig hve sl ay propaga, ot my Dest Sri age 6 on ° Priceociearme pre") c » Roost eee ellen we Pinte wvcer rie ear) aa ere S Bitcroarechesawe Grit aloimere) no mre reacts rsa at pect pp as yrs string Formatting é vem, 9 omic) 2s forme’ 8") uty ci (EDIE rma 38 VARIABLES AND IDENTIFIERS {seein a ct) ytd a yu gs Sg "tice npr kien perms nag nd Panis i al, ‘nln gue seer mony enema mp gas se ‘chit par ye mp soe ne ema be dea SNS SE pa Bey no wapes some mnmemteel et “ils empl of ees go mae ngs a en ey Se Se Se Sat Sil ee ru tas decile Ute tcc, ‘Terese cmb tn a ype hn) aie 9) {Rates nehon blew sie ape of ld mtn nya 3, Ha ‘npr of oles ve a, {sore or a Se ee dee pen si oe need SSS Naeem oer Sy neh sd el a oe (COED rove si ect erin vn nr ss ‘Soprano Ts see aes oy vs a of a pens tar af a ng ‘Enc apes of at, usu oe nt Ta pleas ot ets nathers aay moo og ssh ak pe fens ‘Stare ad lnrsmgr ange ‘Set ued dee ope po de Se HEE) evn resign sn ‘Sta, ei ena tr new a ss ns ek Seep mote pes 1\71. Assigning or lnialiing Vales to Variables ‘Sten pep lt tly ceri mvs Met ce Te echt Samay wien sit reg re sp Ta oo siccteqamg crane tl rap on dee ce oye tt Pye DL rn el Feral ope ng oe comin BLE mee 2 Benito: tana ere eee eee fees raare ame ereens ieliniaeeemates ee ray 372 te in 2 ptm allw oan ign sing alee coe inal Frenne ire) ‘a neon nao ra 3) ‘Site ihn ceo entry Ton Stee ce Pow tsar narra 3s pet), ‘en ato waar bs apr ore Siete entresepeane sens, Spe) Seeded intenadonyranns 33 ee Ny SSiteormacreeteohaceane £1122 Comparison Operators Se So Sonnets : ieee ca Seiclaefecgeaer eee ge Pores tatece spice ‘Seow croqbevaia sah Spree as. 0) ig 1123 Assignment and inplae or Shortcut Operators Gpacgows and ogo op * Seetndenneweatbecpuntr ssc newea care at “Nab gamwontelasaestmecpemar Gang Oran atte sirtnvaneaen/> ‘Sod nts con at Soncih tetera cpa Seem eats omnes ‘entrton age rma ross egne Chance ain Pete ern eon fit nitennergeaar teers ontetat Uinta eaniee topes >> Pla ni {3124 Unary Operators Thy onl asl pr. den et iy ia = Oe “Th rnc cpa es wt sore wk ABE Sb to 128 Biewse Operators ein op AND wth ng ine iro iene becoming ie eron ore orem “i a ‘Soon be eves id ssn ere “nn ssn eH iewise OR) Eevvznae ay men ue io tint sites ee Biwi NOT (-) doped by prt po aly ae ee een i at enero rooney (G8 Tote 26 Tru als Bini pears 1128 Site Operators serine fel ier i png te pee ft opr saitcepenr = yee pee em erg weet he is ae icf ere waiter ‘Gracey a apy cera eyo te a oe He Tae, setae aginst vid stone tte orange Pogue ney Pot ain Meter rpm sco 127 Logical Operators et expen pe peo meet anh eign FED ren rogaenie Logis AND (48) ‘pone eon ea ea ald ge oie pa se sen orl veto apo a a (se. wi gi a Pp eon eit tiasanny ca Arete een (on 1 (2), th eh inne ear pi Logie NOT Teena ig 8 The af ia HH vo tors ocnsnearoprervenc ani daca eo {L128 Membership Operators $1210 Operators Precedence and Assciativty = Pence ao mpanar ry ptr mnt) one © tp cin nate at ae er earn a * Bie Of endo sa eau hemo, asm ope. a Laeger aap ew inert pre oe (IRD ore renin 1.13 EXPRESSIONS IN PYTHON ay paige ery pointe yt ie ey ‘sheers xen va rina whinge le Po, n xpron muta Sec GCSA en note ene emia ag pc, “Semler apn Tape en teat sans AB "CSc mca santa cea pete a Sisk comm neeredcehyheae sre hy natietsa eo Sp cain met Men peg comp Sine {Types of Expressions yh pnt pe rs a. fle {ised on th poston ef operators in an expreeson: The pe opis ne Depry fea pot le fe pra En ne + Poe tirana: peop rr pn ea Bape 4s {Pelt cp lain cpu ty ae Yo Base on tsp th ma tnd on eating a expen’ Tho pt + Gam Ej Ont rey on age «9-2 ‘cat pens Oh procera ae eigen, Ele «Fan Po pin One a ps ing in ag: * 8 2 + Io! esi Oe rn i ar Fal Ege = + Eaten ieee a Po ‘vas On wis eel, rangle» kt 1 Anima pio Out gn sar atts Bae S's 1.14 OPERATIONS ON STRINGS. [rubra ult ing by petri enn isin il ‘halmgsesensce messy | 2.141 Coneatenaton embers one on al 9 ase yn. The es of ing tins i ed ‘sma To a wht ca ag ng ne otro ec ey idiarcoat gent irl mp ‘esate nto ap te Howe ad gi nang ane eee nytt ty il Ln beg tet ie inca ig er ne wee ew ot sue tae nl cast we ore {L142 mutepieaton (or String Ropeiion) Yoon er bt oan ety iy» apy nner ne ay med hm ger mt Tr og mgt or Sewers jem nk veer Sa catatonia recom ei nis gon ong cum ae at PE) resemanmamne (HERMIEND restr sce ip on wis 143 Sie Sering ‘imp ataseerchnces testbed cis ota rb sntrbert Bt ‘Tyee eve cece mr om te of en ert te =a A ash et a "nr eran dln erin sf DLE Sl iat of han stan fr atc send sem oaes™ cn oma ‘ranean The npn at oo Bt (HEERED sree st pominnstin 315 OTHER DATATYPES: asec el ne geo ter dapes 284 Tuples ‘Riis tas oie ino pny ean ened in as denies tcc hath ‘Sipe acm urvileue seen nee "fue sneer hn] Bu fa wet te an neh nee legen (EMEA oes pointe 41152 Liste Lu emt el 9p of to gis i et te cm ant ‘maser Fenn opm ‘Suet gi dla | eos ct esi Te ies he cn a a ee abe emits amet n ire igh yr cm rer, Sew spas cpe rane) ete peas brimiioe + ise) Coeatontes te tere fe aa 11183 Dictionary ty Smee wt iy fsa ele BiGwasce eee rie brome) 5.16 TYPE CONVERSION p> 4827) + anc ‘sence emerge state of th ‘oo nas steer he Fst sae") 4 Line (emar te scn naa cra ‘mie ei iat SURG meni ine foe) ome 9 lets ety toc ge fc er od ot ar he ns es ep ly ai ek “a ie te con ro an ra ocean ah For aorta mina crmertermnnes none ne for ett cameron of {ie tt snr l= gerne ner te ra mtr) 1 © imeem tesa aa") Pines aman hp n o amen an stp os enn Comers an i a cae ‘esa ea hapa ‘ype casing ve Type PROGRAMMING EXAMPLES regan 1 i» progam eters rant an dpa te bex ado wat Program 12 Wet program ore and pet aa of arate of an dt pee a anton {eas ertopa (ter the ale of Cte 2) isn iui ip este value o peptone Program 3 Wie program cael men ts an ung Hara’ ol (hts mons forms en at ana = sertsrenneniee))) femtinne ere fe ait ot we tregl )) 1 fielopat-ntr Ge see san ttle 2) {floating mere tied se oft erage) Sree Pram 34 Wet prorat cet he tics ms pt { tietinue-erea oy cores ott rt pint £3) Oe eats mercies «so eee Liner on y crane ot 2 Sc poe 3) Ganenne mene. | Powam3. wits prorat prom adn stacon mtipaon dion, | Szravasn ed ot selon wo ae nuns. = emer ty mers 23 eee) ctu etna" = “eto netstat © neta >) nesta + surfs + “eve t-ae) ueieate /ceeimates > coerulea on) Pega. wets progam etm aon stacon don and mlipeation re toring pour Si Aikntet tee ce adore |} interne arm) = Xa) fncsctmtes + “tetas 2 kara} seamen «tr = “econ? itera ere trans a a= tir Ener ay mbe (ieee pices Sr m2 initia Strata 2)).8 nce + “serrate, Pram protamine dt ten os ube, Pega 3.10 rex rogram cult ge te ums, Pett devon, see sner repens SEI ‘summary +r ar pt nen dn «Fa en tm yy ‘ti plemented Ser hn ae Ck atm = Rept ene ts he Be imeereaaast Sete Lerten et i RD meron AE my BS cee : Eth eran a pte mease ae Sc inetean S vee eh Saw = Mati Chics Questions a oF ae iat ene esa ti suceetriearermis GE ie eee ED marae Schoen Seelam Fane ouput Uf) respi Installing Python re Downloading Python Sept Bee ting Pn ok SEER Maat conn (a "Sasurdomtyg care tee ane A Sooguee ts | ees rea 0 wes w ie foeelee me ems AL. een Ss ee Pees a secteee nen sie erent enaae ae oa ipl croize Quests Fierekta Soy? PerAtd Sit fo 20 20 40 So kb 1o 10 2H BO Le Be Instaing Python pt Foe St role, Salk on ad i wn Sete : wero ele pa eae ty rane oe ee [ben oo Noe proven om awe.) Installing Python Downloading Python Sip Belo nalg hn, Se Sisto ayn orp Pe rcs atta ccte teem orion ape Fiew A Fue Att Sees Synth oo now r,s tot or bt oe pg ik "Wd MS ar Fg 23) 5 mar pel pen pea con orev 66 apm son aon copa Instating Python fa Py ene nbc os Torn Schema our tna hw rome Nea a til Croce Questions Comparison between Python 2.x and Python 3.x Versions cinereus 23 corn Le wre stme range) terres) poviene tand areng(} nance esc hye AM, ‘Sree Tru) eens eo eo ee ae dene cy ce aa ‘sees hace a el eet eee ee nel woe ren yen rept ree Pls Theat neded capt ee Bon ty ee pe {op nt: rhino at pr ng enh ion i hye owt abn xeon: Whey 25, om ie mecca i i ing patie Intra etm wan eye pps npg ‘peer “INI gin sem) mao pe oh rt at) ha cig eh iit iT yn 2 se ae rgnsowonone (GH i Testing and Debugging BB erin ras conti str 8 Sig ad it hr | cmuoos tes oem, Yaad sa on he tre ae oe nc etre ethane sores hart separ amyl wa bahe + ere feing Reyrein venga pn ho ‘moda nc The pet ung wal eet ai ay TESTING Binur ‘ce Si Sin ed vi open rite ain en ee rn M2 DEBUGGING eh oe pn edie inne th cu egg te a te gt as teers ot Cand uted pas opel eraser ney mp TE see ery nose dma" og (roo na Freon (opann epactng eet tanta py en ede Caer ‘Bivona my non Sue perenne mesie ne Sap maprcneg aye néen tn Pope tn aan ‘rr eit To ig fn nt ei alten any [Pétcee of orvnging Rete isan Th er oie ee TBE) ren perenne tual Ae Th stg nee atmagepemmi ls omfg * Sait Bn enn see end te otis i ee Sec See econ eteangestone aoe can eae moi pope at When rin cor ae Sore eee seen nee ‘haters ng med ean bony node, inet acne t at. Sree s ensue eae See ‘ceinpatame eee ene pm nan pte ep fp in se et eth sleet rane ot ing a Wie at 4S ‘ey pols remembor + Fett forsnd seep tenet es te bun sia heat tea + Fi tin et ce eta ete th i oth «Menta i ray hg ot ge i. Frequent Ere + ng gr rl hi wal ne mtr se is + Fe pi when ey cae pete * Inna tenses epg AA Debugging using Python IDLE neste yo Ls hn dg hy ede BSS peptone eae Se ntl wn ot dat abn oF ome ined noun icing ed [PRD me mmm eg Cnn int tan Fg) Wt pe Ym ee DEBUG EN) Sn ciao reli rep pe eye an in) went pct yn eos agit ae. gue MA Brcatrg Pe npn ng Sp Don ‘eee ft Dn Cail wna etige est soy Shwe Coun beter wt Moin ne a «ite mast Decision Control Statements [Etec gama rene Yo Tree) Futon = Nad Lp Sak Coron s00) Po San» Thue Satara pe {41 INTRODUCTION TO DECISION CONTROL STATEMENTS ae cel ow pes pa itor gen na ran eit ey om a ena | a ear L I ee Paes cael — ——— {42 SELECTIONICONDITIONAL BRANCHING STATEMENTS. ‘en oes ys em oe rt of i eta ending on ae ‘et oe ed om Ta hy oe ou see sates wy ‘Sin sem Sch pee ec eed ac eo eon ca ae in ong ets en up Gt es le 425 4 Statement Teme ig rie a tt tag tooo Beta! rg vam (EE ran cones thiptive ‘tpn ess espe Deseret te ie en ll be ato eterno ale Pan wa ‘nana frm stn ene Darla rane ory creek 422 if-else Statement Feta cpenn bed e's nn ae te eae Tater sow titers sted chs esses Secten eet an cee og at pomp eer cer ester he ise 424 Sf-e1st-else Statement ‘in ao eh ts ‘Tivcum eject ee ence ‘eee ee eerie aa pe ee Sonsenevbee teres as a EHinGia am 3 ee ee, piace raat earth Prunes inten sets) | Pentre ons Sey “e1st(0e8): [coroound npn vat traren 4 tropa nt mao st atc Pe re em ‘Soe lagen so py pne sme ye te tm eas ‘Steers teste genar ue Scere por ocean ere at seen ‘Stars ane te tents gas Fat Owain Fanpop >= een (Gace Second Drape tvs anda, en gros oT On Bote pocn rot ena Fring Poot Natrs | facia baleen tnrmnrnaigeamedepe epee a "Senate etn syannug me Sapna et ied ‘aera [eer rE de anterior se {3 BASIC LOOP STRUCTURES! ITERATIVE STATEMENTS. 431 waste 0p imei oss Progam £15 wet roar cleo of ante euaton. fs inner eae 2) SEES | BB tna « tte = se zz Proarem 8 We program RB ite nt ona ee pred her nk ltt ay te #99 Frame ese cbe of pot naars etre pees) econ of tose eens * Seas) Program 42 tes rogram ren ener enaunred Fin e ‘Nerge poer nasa sgn mir oe oe fring ste i ot Ate) tenon ott OP terrence ect erent cate ani Treen Vins ere errs Beers ea Progr 424 it prog ord chart ancora Ate aut he ‘taro apes lerne, naan ne by eee eh tater any carter") sneha of Somresseearstar ae einer of weprease tr tet cee of era ieee) Sheer ruta sn of wets 6 agit) Progam 428 Vr reranto ete C0 fro umber, cone nh err a a yt 1 ering ln eg tet me si ei con eee the me mr genera. Hence the ended tsk will nt 192 for Loop ete lame one poi mn hs pie cnt Thee ny. ‘Lone simi te lay nae te pat ‘Eo cy ow aye yet Teer tm a neem temo memati hetero olin Pe ct ote ai Fy se nb Faeroe Sanco eer ee are ace a ae Fey acre catego ares on eal aa re age Se

You might also like