0% found this document useful (0 votes)
24 views

Python Record A

It's the pdf of the language known as python it contains programs and theory related to python language. It is uploaded to download I don't love anymore book.

Uploaded by

11Rachana Gopu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
24 views

Python Record A

It's the pdf of the language known as python it contains programs and theory related to python language. It is uploaded to download I don't love anymore book.

Uploaded by

11Rachana Gopu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 24
") python insdallation ard @nfgnrobior cotbh asthdoeaS ard birux > Whndooss - * Instalolion 4. Ooeonload pyfsor 5 Gok be otfeal pybor wehsihe ond decarlead be lobes’ version of pybbor for cstpdoo: 2. Pur be sraallew: > Run 8 doonleaded intéaller. > Ensure you check be box bob cays’ pdd pybtor de part! ab pe boll of be instalabor cxndevo s. vahy Installation. % oper Command prempe Cord) 5 Type * pylon --verson' and peess Epler, you shoal! cee be tridelied pybter vexsiov - coniiquvabten 4b» selbing entered vaxtobles Cel rod dere cduvng tredallabes > Righl-dick om “This fo’ ow ‘Gunpube' on be deskliper wv tle bxplowe > selech Prepenbtes’ > Advaeed sugheo sebltrgs' > dick or * Erytvenmerd verstables’ > In the * supleto vexiahes’ secbon. find bee ‘fobs! vercoble ond cen * Edd” > Add jo pnd bo ke pylon inshollatior deveclawy ord be Nenades drweelese (041 'G:\pubter 89° and C: putter xa \scwirb0) 2 Irslalltoy visleal sprropinerd wo oper Gwinond pave! 2 Tye “pic isda verbvolepv’ ord press toler > creole « votes! Eperenment ahh “vrelvolery tyere', > ackwwole bre video! enydcermerd 0st * myer \cxiede\ecttol’| > hirox » astallation 4. uning packaee porages : es pebtan = based apehiet ( 1k cisaenta)* + fos POh Loew. sudo pacwon <8 pyrco pybmer-fie 2 vers zosdollabor open Teewiral © ype \pybtor 3 ~ vessior’ ond pest Foler. You chou) see bre insbolled pybrop vesen + eee “pips --vexsor' & eraxe pp wslalled 2 pegsas for urdeesderdlig He dela lypes, gevbal fle dlobewerds, blchs and loops * Dob Tepes L. Trleges > Repseserle whol mbes &f> age 725 » lead > Reprecenks ects! now bes ar Pace 219299 » sheng? Repseserls bert ea > none > Alchay* - Beolean> peprecerbs Fae ox fake 47 18- shader = Pee « bishe PP oxdesed colleen of dane. a> Peaths = [oapele", “banena', “chowets “I - qaple = Orexdexd. irmulble colecbior of dans &> Gecxdinabes -(f0-0, 20.0) 7. pickirasy> p alleclion of bea eho pete ar Sladen’ + frome phehay", “age -20 , “gpede* > ~P°3 + Conbsol Flees shobewerds. 4. 31 -so shbuwerd > Exebes code tasted ona arddion ar age =19 of agerzl2: print (ys axe ar adulh*) ele: Peint G HU ae a wiroe:") a. Bhd slobewerd > checke mulbiple cordilers > Love 225 of scowe > <9: pow! C~ Grade: 0”) eed 2owe >=80> port (> erode 26°) elif score >> 70; pind Corede 2c") eke: prah (Gnade :F") | * Blochs A eck 3 0 qeoep of shlemets bol execube beplsee. m pylon becks axe defined by indedadeo - at Poue? - ee pope 20 biol onde") peinh (-76 0 pod of be of dobroert’) | + Loops: @aedeoe » tlevoles vena ceqperce (ike alist, laple ex stzina) ar be pail wr Papple’ * torana", “cheery T? print Greoit) @ while lwp: Repeats &bra asa condbior uw hue o> count =o while court 25: prvd Court) courd +72 Exomple- fone <* ident” age -25 18. Sloderd - Tove eabjeclt = D> robbs", ~scterce’, ~apghech "I perl (7 Nome: frome?) privet (/'Pae : seae?*) prtd Cf 3s sladend: § is-sladerd?” > pothl OF sobpeh: $°,° joinlevkjec)3") Spades = §° robes "25. * sererce": 92.) ~Enghsh™: ¥ 4e sabjecl , grode co qvades. tems?) sf qvade>= Jo° pstol C4 *fsabjed? >Grode p*) ht geode sz ¥0- por (¢" Ssvbiecl? > Gade 5°) elif quodle x = 7? pond (1 fudgech 4: erode c”) ele ark (1 fabzecby + emoder*) ropbes = F wrtle pupkese> 107 & puwber 722-0 5 Puind (4 frombocd & ever") else: - "ped mee, x) Ndiebes r= 1 8. progears for undevsloving Jurchiors, use of Ly ild 17 dandors. user detind furctens. + Bulb -in Funcbiors. puller prev ides Bel BP lenbep fandx®: Bal gon cae bee oteecbly , Hore a8 DPE Becenglec A. ‘leney: Rebewrs He lerghh of on cbjecbs ae — tails =Lapple', ‘borara', ‘cheery'3 peob (lerCharls)) e “hyecs’? Reberrs the type of on chiecte ar Tubes = 10 prod (bupe Crmlees)) 5. somes: Relynirs the a0 of al dlens 10 on thewble er umber? £12, 3, 4,53 pend Cevrelnewobers)) be ‘weve: Belem te beat dele nar ideale a purobecs 2£ 112, 3, teat: perrd (ora ¥Cresabers)) 5 sediedey': Reberers 0 debed heh of he specitel ibewoblet eletnerbs ee number = [5,2,4, 23 petrd Csoxted Cruibecs)) + dsex- Defies Functions. gu cap creole yeux cor Awndions using bre “det! onl] Hese awe Se Exomples: 4. staple parclon: A faeckior bol parka geeelos aqr — def greeb (ree): poerd (7° pelo, fno1e} |" ) goed C phohaw') 2. fardtor «tlh peloxe ole: p tarclop tol olde deo rumba apd xebaxrS He wesolb > det add_ruinbers (arb) vel ath wecald = add-nembers (>.5) pend Ceesall) | s. rarcdior eilh cofull pequreerd: 0 eriber pe wa a cloud volue tor 01 ereguioort > get geb Crome > ~Guext")7 pserd (7 ~ pelle, Erarve} i") quedo) aveeb C Bob’) n. Fonclter with vowtable Neiobe- of Pegumerle > 0 tribe bod acces a vortale number of eae Ss delenl. pombe (asqs): Ae pumber in avgs? peibbCrainbes) pets rembers 0,2, 3, 4.5) 4) propams & Use éxtsbing modules, packages abd 6 modules, packages b. Using Sxisbirg Modales ard packages pubior comes cotbha Stordard Ibsoxa bob wdludes a wotde wonge of burlb- ip iodlec ard packages. you car use Hes? modoks J bx impexdary phere into gue gxipd imposed mabb petrd (wobh.apbl)) — * culpobs > wid geu con also insdel) ord ace birsd-poxdy packages usthy a pckoge reorages tke *pip'. For txdone pip iosbel wequeste Thep, 11 yon scxeb: mgood wees wesporge = sequed's -gebh C blips 21) -- ~~ ~~ aom') psd Cosporse- sols code) 2. cabling jour corr raccules A modble 2 snodly a pybler He (s.Pa') hel combore debiorhers cf fircboors, classes, 0 yawablet, Fer sore, yu could crolea wredsle rowed * mytredule py’: trgmedulle- Ps det geeed Crome): xelesp #" Hello, Srome}\* Wpu cob fren use pare wadule iv arebeer scvight impost mngrecle petrl Goyredole- greed (*plice’)) 3. Cvealing packages. 0 package tsa collecdon of module organizes na Atwecdists. To cwwode a erckeat 4. ceeobe a prwacbory tr yor Pactoge > OX Lxomple “way package/”. 2. Add an* _inib—-py’ File: This He con be enply ox ale? wibtalzader code. ib wrdicoles trol He drecla should be preabed oS a pockage 3. @driedule Files: For geamele, *puwodale 7. px', \ mymodule2- Fe). ek gars package dvectorys shvechne porght bol hike bbs: exspochage| —wit_pa reg module ¢-FS Wigiecdbles. (ll yu ao ber use be package wn pox xxiple rote wypachage imperk warecdalet pet Grgmedulet. come farctioner) 5) progeams toe implementiors of all cbjectl- owrerted Canceps tke chs, method, tnherbaré , poluwowphisio ele (real Ife Evares mut be covesed fp bre implewertor of objecd oxten bd conceyts) ) class ord objed: hel’s considera simple Example otba'er’ class > Class Gow: det _ roth — Get, bard , medel, yoo): sa. beard = beard sat - iaodel = pode! sell. secs = sea def stot ergcne Celt): pend (7 Ssell-bward? fed? meceli's engine Sloxled.") My -Coor= cal Toyola*, * gorwolla* , 2020) ny cei. shord - Orgine > 11) Inbevdonce? hel’s exlerd be ‘cx’ class fb a *blesdytctax’ class err chess Elechwictarw (eax)? det—wib Coat, tward, rodel, door, bolleny-stze = 75): supes0)-—_ init — Corord, redel, yeuts) Sel}. bobbexy- size = kabler. sie def descuthe- talbesss (sel 1) prt Of this cox bos afelt boheg-steej-kob hobléey-*) M4. eledwe— cove Elecbstclo€ ( det spear Cselt)i pend (“Dea hawks”) class ab Comal) cel Speak Galt)? Pripd Cat wrote’) de? make-antiral- speak Cab imal)? abimal - Speak C) ragedog = POS) wy-cad = Gabe) moke- ovimal. speak Cgc) make- abiral- speak Cory cod) ®) Srtapsulabon: usirg pswwle ablsteabés ond webbed. class Book Prourd ? Se near, account nuvbeee, belonce)) selt-accout—nuw bee> account resob& sel? balonee = wolance det depest (seit, arrcurd)? t aamceethd 20° Set. polonce 12 omcond pond (f° pepesded £fowwentd. tes polonce > 4 Sseth— Me esabl-cepestl amoutd wth be coscere:’) det withdwes Celt, armcend) * 1% ocomeund cz self-— polorce: Selt-—holonee - = orreeint a pried (1 isdedvees ¢foweunb3. sles holonce: dfsdt. — helene 7 2 peel (*rnsuthererd pards ox toro'd omeurd -") dt? ge)_babree Cecl¥)> welast> self. — Jobe My-accourd = BonkRecl(-jazyx6", loot) 14 accears decesté (500) trg_-acteus -to tbtadrous C00) pend Goy-acceand. get - boloicecs) re) progears fey palbexr tood:ng should be coveced- D squase palleer def petol—squaxelr) : foe i 10 warge Cr) pews (4° 0) print. squaxt (1) of’ 7) Right -angled teargle polbese det psant_right-ongle- dstargleCr) be 7 i0 wange C1, +1)? pewb (7° *2) pint. wight - argle- briorgleCs) in) _ pian fallen det pried _ pyar Co): we 7 ip yarge Cr)’ pend ('*(o-1-4) 4" “Q@*i#) pewt— pyreunid (5) ch og 23") check- value Cio) ut) Malbl beading. inposk Pheeading def bhstad_ fardop Grower): peird C1 “Thsead tome} 1s wunbirg") bheeod 1 = threading. tread Cage! = diseed-uben, ays -Cone',)) Mread2 = Uoreaderg. teed Cmca, = treeadtewebion, age %20"* )) Uneead 1. sberste) Osead2. storsbO) devead 1. jor Yread 2 jomc) 8) progsas davonstyal ing he 10 opecolort the yeading hore tile, weidirg ilo He tow ditlecend tle lages Ike dole He, brews Hk, de i) Reading ard uxalrey ted. Files 1» Reeding teow a lesb pole with opeol tewnplt-bxt', x’) as tle: conberk = fde. weade) pert Coordend) dwrtling boa bexb He cote oper Coxample. bxd?, “e!') as file: He. caaabe (-velle, word !') #2) Readat ord comin Bree Files 3 Reading Kore abineay He coilh open Cewomple-bie!, wb!) as file? corbenl = fle. weade) penk Ceorterd) > covliny a bavany 7le woh open C-€romele- bir!, “wb! )as abe: file. wrile Co'\voo\x0 | \xer\xe>') i) Reodiog ond coxtliny csv Hes > Reading tom acer fle? cen as tele: weader = cx-weadesl He) foe rex 7 reader peird Cxeed) > coxding bo.acor pele anpow' 6st Gis was Newaleicayyy pewlmer'’) as tile: wntbes> cev-tovtbest#He) eovtler: exalevoe (Tnowe’, pae') wwiler esetbecow (tplree', ~30'I) ccxtler wwribeserx( cor’, ‘95')) 4) Peogrars © pedetn seoebirg , adding, updabirg je corbent fom be File ) seasching corberd in a File seoxthin's bor a speite shyt get sench_in-trle Ctlerame, seach, bese): coh oper (ftlerae,s’) as ple: lies = fele. ead hese) dos frre. ruwber, fire iv Guscevale Gines , shad, -1): a seaschbeem mv ire: peo CF'Fourd “Secavch Jere)” in dove je. mmbst: jie shad seoxh-in- Hle(exarople-daed?, “seorech-Levte') i) ading Grberd doa tle peperdina Content to bre fr of a fale: def append bo tile Ctdlerow?, corbent) wth opth(Slerome, ‘a') as pe file. wibeCeorterd +") apperd- bo-tileCexomple. Lext', ‘News corderd fo be ated’) 1) apdoling Gorberd iva tle det ugdobe liven. tile te retet detaged _Itme-rowsber,, ras_copdent): cobb oper Cilereme,'x') as ile: ines > File. seadlznest) id 0 2 eaged- ke. rerobee <> lente)? fines Stoned. kine puirber- 1] = per-conlerd +Ww! wilh oper Ctlerome, wa')as tle: Hie. toxtbel ines (lines) aapdole- bere. tpHile Corennple bib ', 2, ‘apdobed corbert hx lene 2!) 10) Basie proaares ehh Neepy 0s meron, seorchry and sovbirt! , coled bt8 ord Sheng pandlerg 1) NPs ervves opewadens > Geeabing ard Displagingy an pres tps names oS np ave = np. ewrag CE 2,3, 45D) Pund (° Assad", axe) > Seaschin§ wap Aercs? anpox} pares as PP aes = np-crrsay (C10, 26, 3, 40,503) indew > np-cohese Casr== 20) peed (~ Inder of 30:", der [e]) > Sotiny ap pevar. inpost mmeg on PP ) ave = pp creas(LEs 24/5161 Sextet = np-Soxd Gas) prin d (-Sexded pangs”, sorbed) 1) pole ard Tre cpecalers 6 Gbbint coorrert gobe ore Teme: tem dalebiwe imgeub cpbebtre nets = dobebme ners) Penk (cexerd cobe ard Tme:" red) > Fowmablirg cabe ond Tt Kom cobebune irecoxh chhebroe Freee = dadbebire por) 5 tetmaleercabe » ees. sbbbore (py pred reeta175°) pemt (Femolbed gabe erd tune:", brewebted-cole) 111) Shera Handling D> Base chery opexobiors Jexl = * Hello, ecotd length = ler Ceerd) petnd CLengdh of shear") lengds) upreccase_tercd = berb-cippext) pert Cuppexcose:", opprcose- bert) epoca bend. = benl-veplace (2 ubyld +) * pulbor) pet (“Replaced text>", weplaced_Jext) » spliléing and Ztping Sbetrgs bod = “apple, horana, cheveu” sehhterb Irdeving and sieirgq impoxb panes as pd cbla =f1e, 2, 20, wp, 505 Seaes > pa.sesres Cole) print Clement of trder2?", sevtesl2I) Peinl (“sce frora indee 4 bo 32") per! (sexes £1143) > Basil opecoturé tinpot- pardac os 3 dole > f2,3, 4/8) Seetes = pd. SextesCobs) ewo_Sesres 2 Lewes 10 Pind CSerzes atbes addcbien”) Pethb Crew sexces) 1) dobabrame Opecalions > 78 and wxsplaging 0 pale frome: impoxt pordac os gd dole: -§ ‘Home> [alice “Bob', ‘choslze’l, “pge’> [95,30,253, 5 ‘rds: [Neo York’ “Las prgeks', ‘cercoge'I 4 = pd. CohsPwarre Gabe) Pstrk ( paloProe:") Part Gd) > Aecossiry Goluwrs ard Arss. mo poss apd rE shame" :[alice’, ‘Bob!, ‘chaxtie’L, *Pae’? [as, 30/353 5 cil’: Foleo tost!, los prgeles’, 'chicego’} 37 > pd. Qala Prowe (dele) paint Co slamet @leanp:”) pend Cad E-nbree I) Print (peo ab tndew 42) pent Caf-ileclr3) > Fillecrg cob: 2 [plice’, Bok', ‘Chosdze'T "3 [25.30/35 4 (Tonle yorte!, “tes Praeles'. “Chrage'J 3 4 = pd. palokrome Cote) Yilbewed-dd = df [arC-nge'T 725 pend (-pillewed polePameoheve Age >25**) Print Gtldesed dt) 3S aig ord updating Glerers ob Sas ed — *Nowne': Crplice," oe’, ‘choslce’]” Greabing « QoleFrone cob sig voles: import rardas os pd wopert rumey as 0P dole =§ “plore! f"plice’, “Bob! ‘Chaslie',‘ Doxid ', np-rar, “Pge’: [25, np.nawn, 357 Ko, 303, 2 oe [isles yoo! Yes angeles’, pp-row.'chiceg?, Hooedor'3 dt > pS. paloPomelacl) peek CpoloFrotré astlér MSS volves 3") Pint Ca) > Propping missing voles d7- dropped = df. hepreO pripd (CInpaleFaire axle rope t1ssir values 2°) prem! (dt_ deopeed) rellang etrssing voles t-Fpled = d4-A\Ihoft seme’; ‘ankreen’, “ae? AY [pge'l. wend) tothe! unkrece 3 pemb(-IradaProrme ofler Filling missing vole : 2) =o: esint Cad _frlled) int) Trobstoxteas ton acweling a opal amgox pohdes as ed bla» Shee Lele, “Bob! \chaelre', pavie'J, Sege? 2 fa5.30, 35-022, “soles Ssccow, Gecor, Toes, Fovee] af = e. valehone (lof) peick Cocetgtral cabProre:') sapplging « tanchion bo 0. aoluann’ at Psoloey') = a# F-soloe'] apply ( latobolr x2 x71 print (“In tolePrame offer salesy Inceease:”) Prtnd (a?) » sbymalizng cable: from Skleaxb. prepeccessing ancext MipMar Slee Seal imrbx scale) SILC ge ‘scdkorysy = selon tb bearsterto ad f1'ge/, ‘Saloees’T1) et0 Cin pederreme otto slynatriodee ”) Peind Ca/) ) Encoding Gabegericol variables. > cveabing 0 pabeFrorne totth Cadegorical pobe- pert pondes os 3 cele 5 os Dokee’, ob! ‘chaslee,~ pevald, eoendes!: 'Femeil'y ‘alt’, Hole’, ‘eewele’] ‘exdy's [sles yeark', ‘Jos Pregeles!, ‘ch reago!, tyouster’J 3 af = pe Pabarometeole) Prtel Corcairo! wade Poowe>") pend Cat) > One-Hod ErceclsPg dt. erceded> @l-gel-drimiores(at, colowons -Cede'D) Print (“In podarsome avler one-Het Srendlirs:’ pert (at_enceded) preqvan tos ctx visualizel‘on sheuld be Covered pinperé BONS (by enmak pmposd malplollth. pyolel as pid impos? Seabowp at SPS engi eds ote 4 Lobd ao Compe dadase’ bola > g9s. oad dobosel Chis’) # seb visuat shale srs. sed site. Z ghibege'd 3 Pld Pause (fasre = Cw-s)) pik ple laode [-tobol- brtt"T, dada S‘bip'], "0%, colb='b') bl8.2de C robo! atl vs 7’) pid- x label C- toded Bill’) plé-ylable Cre!) p12. arid Cree) od Si ecde a bev ie size>Cie,6)) SS Dee Cx'folel-btll = be', coher do bie \Yame', poleden'acl pis. geble (mbel Bt ve Te hy Tune) Pie -clabel Co robot er’) pth. ghee! Cone) ee sho ie elt Fil Pigeme Caste =Cree)) sns. scabbesplot C= fobal- bil’, bit biadode, wom ‘tree! nghobles Veoboaser) Pld table C Yolo! oil vs Tep hy Teme) Pid vieebel Ctedet gril) PL-glabel Cie) pid-steoO creed « bow plet ) pil. figawe Cfigstee = Cieré) : 8. hoxplodlsidoul jas pobot bi? “doloceola, rolelbes reste!) Pu -didle (tala! tll ty rgdetieudze? by poss!) pid-y label Cour ) pid -gbbe) Crk arti’) PECL scot roe ot eondolint Pb -tteptse Lirgstae -Ce-©)) SPS. bealicap (dol err), onrol Tre, Crop: tao kaart! tek =! -of') pik dle Ceoxdsdin Uendiae') PIL steed) *

You might also like