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

All Unit

The document discusses problem-solving steps, features of Python, and its applications in various fields such as web development, AI, and data science. It also covers programming paradigms, object-oriented programming concepts like inheritance and polymorphism, and basic data structures like tuples and sets. Additionally, it touches on file handling and the importance of modules and packages in Python.
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
0% found this document useful (0 votes)
24 views7 pages

All Unit

The document discusses problem-solving steps, features of Python, and its applications in various fields such as web development, AI, and data science. It also covers programming paradigms, object-oriented programming concepts like inheritance and polymorphism, and basic data structures like tuples and sets. Additionally, it touches on file handling and the importance of modules and packages in Python.
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
You are on page 1/ 7
eoblem? slepsof . rae solving. Uni « peoblem:@Pzoblem is aN condition issue O€ 6ftualion that Eequiee an unique solution © tn otheewoed it is on difficult coming white aekeing. achieving. the goa) + 6leps of pzoblern solving © Identify the pzoblem @ Uundeastand the pzoble @© tdentify the alleznative way to Solve pzoblem @ select the best way to solve peoblem © List the inskuction thal enadle your to solve pzodlem @ Evaluate the solution 3% Features of python ~ Pylhor’ is genetal puspose interpected intezactive object oriented < high level Pzogramming language fealuze i) Python is known fos its simple Syntax fi) Tt is Known foe steaighfoewoed coding style i) It is cross-platfosr: language that can be used on many diflerent systems im Pytbor is Free softwaze that available to anyone Inhecitance 3 polymozphism Nt is a featuee of object] » polymozphism culows otien}ed peoyzamin to have the Same name! in sean oe behave diffezently Fi iil hievec i inhezil ites |} TE can be ac : ik re een Teal emeibes Hh ough method ovecloading class « Types of polymozphisin i rt promotes code MaKe) _ pine time polymapbiss it eosieé to maintain & oe elerd Cae this type of polymngshisty is «Types of ‘inhezitance deleemined ducing the |- single inheritance compilation of P2e9tam ~ multiple inheritance = Run-time polymozphism |— mutilevel inhezitance his ype of polymozph ism ~ Hiezacchi¢al inhesitance is deleemined ducing the * hybeid inheaitance execuetion of the i PEogram + jnhezionce allow a class 40 | aouiee peopesties. K€ pzogeam pazadigm Tt 1s ah way of peogzaming that peovides Fzamewosk to the developee to sieucluze and oEgonise the code- IO Peoceduze peogzaming :- Q It is on patadigm Which is dezived by situcluze pzogeaming IB the peoaxdute is an block of code which peefoem specific task [ii] it can be ses teused though out the Pzegean Gy) featuze= Joops € whije condition fae. ©, Pascal ID Oop's :- Mit Ceganise the code azound object ¢ data Eathee than function € logics [i] the obiect induc of class ,in which data ¢ method ate opezale with the dab “Wxt cupost object oiented pzojeamning Y Fetes polymerphicim , inheeitance Ge). rag, ch gobsrt has lange Uses rere] % Application of python @ The Python Peogzaming longuge aze | Ubed in web- development ® python used in AL ® python used in machine leaening. © python used in gata science © used jn the Jenetatioh of mobile application @ Used in the problem analysis 2 mainly used in the coding of high- level machineries, I@ function peogzaming z- O24 is an pazadign in which comping 1zealment is evaluate by mathematical fundion IG) Fealuze> fFizst class & high class Gi) e9. zava sexi, ® logical Pe ogzaming :- Cy it is dopend on the 1egical foem in these peegeam, sel of peogeamsenence in 1egic form which is expressing ewle + fact of Problem comain IG Fecat lee @ _analeg datalogy histty of python © 1954+ 0) map, lamba © Guido Van Rossum Filles eeduc 1 1970 Bac comedy show . rmanty pytion cigcuits © 277 9: collect by |® 1380- foundation ® 1989- Cwr netheeland author * \Uple — cynieZ \Tuple is ancollection of Otdered element ) Tuple consist of diffezent dalq type like int, Float StEing: i) Tupple’s age immutable mear's we cannot modify o¢ change the tuple aftez it has been cteated " Tupple aze weiHen in pazenthesec) €Sepezaled dy comma C3) ) Syntax? Jupple t= C12 ¥ sets ~sets aze usefull Foz peefoeming malhanetica] set opezation such as symmetzic di ffezence. set opetations :- DW Union +--the union of two set combing ll Unique element From bath sets — opeedfors:- 1 OF Union c) method seta: £239 Sebo £3, 99 Union_set = Set 2 /set2 Pzint Cunion.set) 2 Inteesection :-- the inkeesechish of two sels zeluens the clement that dee Common Jo both sets opezetok - Roz inlersectionc) method he Sere £2, 3, WF Sek 2= 3.4, 5,63 inlessechion-cel = Sela & Set2 pein? Cintetsection-set) %* Exiend yihol} = the extend ¢) method in Ayths ) fol is used 10 add multiple lelement to end of hist ) -rt tedes on itezable as ‘an azgument & appends each element of that itezable to al : yr list. extend Citezable) Append the append) melhod in P: is used to a Single elemen end of list. syntax : list.append Celement. | list the list 40 which you wan} 10 action element -element - the (fem you want to add to the end of list Jey, my-list=£1.2/8] -eg: my.list = C12) onophee dist C45) my. list. append 64) my.list. extend Canodhes- list) print Cmy.list) prinicny.tist) P= Cae op ofPs £121 3, us] % pop O the pop &) method in python dictionazy is use fo Eemove specific key vale. pai from dichonaey ¥ Feomkeys 0) @ the feomkey ¢) melbod in Aylin is class method @ Tt ceeales la new dictionaey with keys Feor Sven sequence ¢ values set 40 a Specified value. eeluen Value Esnlayt- dick Feombeycseqvence wale} SHED Jesequence + This Is sewenae oF NS. | synta that will be used to cert I | dictionazy. Pop CKEY, default) new dictionary. : Je value + this is valve thal will be assigned to each tegion In new dictionazy if not peovit 3. Keys :[apple;* banand, chery’) defaul_ vale =O ict feomkeys(Key, oe falt-value) 0/P * - £ 3] ea. Stig Imy. dick C'name Yeohi, aye", “city's pone’} lase> my_dicl.pop Cage") paint (my. dict) S nam Yi ee ; ¥ For loo : 3) vi ffezence :- -the diffezence of (DA foE loop is a PEOgzamming Gwo sets zeturn the element that konstaud used 40 zepeat at block axe present in firs! set but not in| of code a specific numbez of times Second set {where you define stacting point copeeator :- C-) 08 difkeencemdbed a conaition to check at each e+ Seta = {2 Be4F itezation @ an inczement /deceenent | ee, bherof ae ere $3.4 5/89 jstens 40 update a counties vaciable | _Linside the leony outside loop ae set 1~ Seéz until condition becomes false bk Geeak Conhine Laie taee essentially @) t's way fo iterale Basak |W cotimues The int Cdi ffezence. set) 1) Used to é epee theugh a set values efficienily — |imp og iHeration | roop ot iteeati oles C24 oe li wheze you know exzelly holv | used with suitchfi) pf used wh Wsymmeteic diffegence :- the many Fimes you Wan 40 JeeP eee laikhilee Bymmetzic ai ffezence oF Iwo set aes er tased fay keyunad used ere Gne clement thal aze peesemtpsyntaxs : ee beeak | in combine in erthez set , but not in dot foe jalizaljon 5 condition; inctemenl La Break 100 ¢ a lows ikend i i i i opeaalos:- / ox symmeleic. dilfeeme deceema ) Beg enene ene se ey 3 4. FOE, iin pre: cin iF Nyy cones! a 6 eee zint CB" i . iffeamce seb + Seta A Set \) conteel is insane leo conneltc aie eS of) +s reanterail at, . Derpulo cinhy fenrothy operator winculable crore Dike Formas opertor Ch JaXlow wers to contruch Geing replacing fONrOF chving withelade stored] boy Ne. “Tre ctotement: baiog wih Fortra « ied of S29: 0F choy & CoMenton eee ‘Sudo 2 * ZEORMAT “fs Cévaiuegy), Progiorn = pomes “Yash” age = |e print (Names Is & Age = fd” +Iy (Name pe) Print CelName = 1g MAge= “td” EC ptt, [6 )) IP t- Nome =yalh & nae is Narre = NIH & Age 6 formatting symnbor : A CH chav sbdor fi ~ syneddecttvalint RN Sm String» Lex oF +1 x- Hexadettnal No. > - hs — usncigned decimrains eh TOCkOL Yat No. #1 F ~ Pleasing, goin No - Qsrring TNaieMDKN.= by UaING™> operator Two Shing Ore Combining, oF Roa a Sr chy As Myero” oa = “word”? SNe = SATE TONER ovine (s€3] AP = Hallo word Dssrirg_yeperition:- Te Sing, conde Yepedd by RNASE Ssyobol with cped'fle Number of Count e-Gt- str d= “Hero” Stra = say ates eTINe USty2) olp :~ Hello Helle Helle + -pratron veing Lambda Fun® to print & mersay even” itnumber mk even & ode (Fnrumberi¢ add > nurs int Cinpur (Center anumber:” }) (Foun [2 =0 e. 0S Cod) ever — edd (num) oP '- enter anumber:- 2 even. TOMONON COI TFURCHON Coal Clodetren! MVOWEd the Fundton - 2) when furcion ts lnveled the t Preqrarn coONtTo’ jump fo cal’ FureHon. BON, cores furdton exeiuted dhe Proyram Contro\ Pas pOUK ro couring furci'on. eyptox! - {Juithour parameter > Ful Name () awit porometer> Ful Nome gee. Fun cts) Nortel véFlanten) pring, CU" Hello worm) fun” (54243) 4 exptain puihon ctting ate immusab\ Hers oS = string ave trnsrudable wean sroy 9 ® (Ele) stey CANE he Crores = Whenever ane ty madify anexdtng opi, Noriamle a new ctringie erected | ay m Every objed te chored tn memoty +0 ft Oub Welter AWE varioble refering 70 came objed or Nor wy weirg Ht OWN Teh He TEMeTy addTes of tre Obed Ne sted @ sya point to SAME Wemory Locadirg goin to same object ege~ “etre = Hae” int Cctring te." £104) om (ogo etre tet Ces) nC gre ism » vier ais? privet” Boot chr aie: PEALE chy des gh & — priny UM ete 2 after corcennsion Q PTINH(ETD oF SAVE Es jausw) errs ssi A ain COSTE ATS at EHF chrg ist, "UID ee + midule & package iy PYstoN = wiedule :—jnadule the pre wettten piece oF ede has OIE Wed to perform commpentax Like Qererodion Random No- performing meth oferohbnerc = Roi Way to We madwe & to ccd import todwde -Norne oP first Wine OF program od writing Madule -Name-vor te accers fur of “| volue “with fame.vay 49 Gmc furchdn of vou with naire rare intedule. Froms---. tinportaraement — P madWe MOY contatn def" for many vanbdie of Fun. when import madule-Canwe any varias’ of AUNT defined im tnedwe hd tf atin only Serecied varibdste Fun" then ure Tmnport chines olp 2 Helo’ Word 11 ht . 7 afk La rplain with Ale Poth «Wha 1s | » Fhe Paths Te Oh Os ond Opsnetion oh IU in PY Hod MS > Fie is o Clacton dp Date. Stowed en Sacondory StwoaB Aevice ike Hag aisk- Bl Poth: — Afi Pecth iS the location 6 Filan yor Cormpurtat « eofhis Poth begins at root foldsn Z In Ain uindows iF Gm b CN, Di Vow ether = Tha Chor \ Usad th Poth Nema 16 Calleol CD alivibes? i Types ob File . i j) Tat Fi ASCIL File iS Simple HL Poth Collection of Chom thet oe hhumon ‘¥2adable form > -P Deals with tant Stream ~ each Wine Contains any No- ob Char incede Ons/ mors Chan” including Spacial Chan thet dnote end of FIL. ~ When data is) Written do File, Zach Newline Char Convarcted to Carmag peteon/ line fled Chas. * “Each Nine of data sends With Valine Chat and @ach File whds with Special Chost Calhad Send of tile CeoF) char. Z)Binawy FU: - Contains dose tr ancaded se duclio/ tet cleta Can be Present ~ Pracessod Saquantially OF Randomly Depend @ Upon Nard - us Can't ead Contents tn bihosy fi bacause To in cencoded form. ~Eumn if Sing bit ie Changed then ik gets Corrul Or. SHort Note on listed Fils Opmart Loith Synten | rei 5 nba. object = Opn (FL -Namusmeds) 69. File | = Oban C“Fity t-te, Ww) Fils 2 = Open CFL dat, wt) Print (Fi) Pyint CHL 2) *Close Fil. : Syrtan + File obj- Closel) 29 F = Pan “pmoFile et”, “FD Print Fe read OD fF. Closed) Hello, taelcome to Python ePuading FiLé ue ae File obj: stad [count . SOE opin Cidamegin txts "YD oT pasink (F ed OD FCtose O Hallo A, | Peaattinn Writ ng AUS. syn Fi Wobj “writs Csteing) 9. -F= Opan Ch aharnoFils tnt wt) Fe Writel Hullo s Erj eying Pythan |") £- Chose ed ye £eopenc™ damofiti tet") “") Print (F read OD £ Close) Halls > Enyouing Python} ‘Le Position . . oe Pla objech. Sack (OFFact{ltond)) + Renaming File- ; si hee . oe seanarns ColLAl NamerNae Fiano) -f oret OS wt ” ° eo open Cavan et Pt”? Print CofE Renamed”) Fie Conard * Deleke Pie. Syntor. Os Faroe CGiw- Name) - Teypost OS Ca ee amous CPES XD Poird Ch Delted™) Oe (orked- yt me Sh Fils how i thection il veady AY ‘Pas be oh & Fibkerant rmot Mestad. ‘ y Cussant Working dimctory. = Cattwac> Motred) Syrian, OS ct Ctud cy 3+ inn bor OS Pains Cos-getculd CS’) €2\Usins \ Local \ Byogram\ Pythan PIIMKdie CDF USed Foy Craqhion dy Now divectory Syntaw | OS « micdiy CURL. offi Nema) ‘29+ Import OS : Os- miedhi'y C’Newsalii") Print Div Creotad --") Dix Created: Explain the following Lewns;- NQbiech:-Gobjectis basie unit of loop. @ Tt is basic yun tame ently in loop © Anything having itt Own 'propey ties can be Consideved ~as a ‘object! det" An object isa instance of a class. P2* atlained through inhey Containershi p and” poly mMoPhisey” 7 : ni ata Abstaction Gt is procels aa (unit=) [@Reusability Developing Codes ane at can be teused enhey in Same Pres Ovin diffetent Peso Tes OBE Name] Syntax i Retbate | otjectName =ClarsName()} data and function are defined ints eee a S* Q woy that only essen tals det< : Yibute 3 a Sis Student C ) aye tevealed and impleme ne pune dene | Y ‘ ae hidden() Main focus is FO Functibn wv [Object classname: Seperate tne iwienface and Method £™S9 Passing-O@A method is a Ne tion associated with class. implementation of programme: (Dola EncapSulation:-Olso called doe Shiy mented of clas con aeceaicend, [pring the technique of Peak Tass Saat ¢ funtion into Single class +0 hi ot Unshion into sing : Class G) Two others can comMmuri cate enero noon aeloue oF Class fro. with each other through msg @ Anobjed ASKS ANothey Object +6 invelve One c \tS Method by Sending to msg: Sendey |Msg -get de tors Object Lot oar ith Rive: - in cove Fig. Sender Y ‘ nig to Teceiver Obie ge Go ge NS! dejails of student {-e the Sender (5 Passing Some Specific information to Yeceive So the Tecwiver send correct ond precise information to sender: 7) The ee Sent to other object of thie specs he Teceives object Method name of teceives Should invoke ~7 Method must, be parometerized . (contaih. Patameier! Containarship Hats abiny of Class to contain object OF ONE OF More class member datq. €g:- Class petson Nave an object of class Student and Nis dota Membey. This Would allow Object of class person to call the public acto Here, Class person become container ond G Receive Object ntatnen, Class student become the contained Clats.- containershiyp is alse calle : as composi ton. — 14 yepresentedshas =o! velationship: Pelegation fOne object is dependent OF aNBihey object +0 provide functionality The biect receive jhe Yequest fox Sewicd delegates it te another object iS called We delegate: is ~The propery. delegation emphasizes QN ideology than a complex object i Me de Of Several Simple? object: as Thas-a) Ye\ationship: Uset.— Enca plulation organize the date and Method eae e@ that preven data access by function: Fi three levels die QAny data function Nonging to any Class and i+ is lowest level@ Any datatfunction with access Jevel protected can be accessed by that class ov Inherited class (class inherit from it)-@ Any data| function with access level privakecan accessed ae within cla only ¢it Is hig hes: SF The following concept cin exam Me [O) Punic vowiobie ove anose vanedirs | Be Built fo Funct ~ , roi * Aetete aes oe check 5 Gal sek of. sN-#he 1986 ond class ond CON OP cer BY USS “these “RuncHon to cheek [the e088 ond Hem ovlbIde the lass _ Wrether=a_ class. h lic : IO nu members Mo pylon closs ove pubI by Uelnull ov Nos get fie valud a gor stisibute Dye rompe = a}. a Nev "Value ox even delete altahae [close Shuden™ Al TE onan functions ave = Jeg $f abtesbul detain tee ONY gras org | Dypeatle Cokjs pam) + ater SS Sti Roi =# AO vors= [vary nc fige is used. “to check if an object [ Seif-weme=w SY vot2=S0 z (epee ables or net 7 thy vsrugenr Con Toy) GL SJ var C3] =~ 3] getatts (obj, namely defaull],): 248s. PuOEC Reltnva. 06) LDN, del Nort. : 2 meet prin (Wore, eyomeT ~ This Funcifon ts Used to access or get cthe attajbule of object. [© Prive veniadiedlere fheee vEWDDIes thot ave denned jokes object asia _fiect joramder te case oh ESD oe by me metneas ofmof | rhe seco Raroncter ik Waiase ae a A poet a ww Ei Tne pvUalevenovie are vsed anh geuble ogee cere (AYERS Bl _setedts (obj snornen vat): bitte val GnexompiPU = This furan is used ~to set an) Sbule cles) SOC 10f on_objec ee : > = The -firs+ Pasameler_is object eee Vail — ele en fixst rameter 1S obje. TO sei oboe Fw pea vodonle Tea >The Second forameler ta Auvabule_ Name azamerter 's New Value “Fox okt vi bute WW stil. Nomen + peivaie verianie ‘Nome ahy = Student 00). ToyD Teennt Ror no! © Goxkage Glleclfon =~ * = 7 on ferform aurtormatie garbage Cees . tae alate tt deletes at “thetol cts ‘Te demonsteale “the Use of getady, automatically, No longer needed ¢ have [9s icy, delete? gone out of “Geope ~-to Free Memory. I. 2 u ete “The protess by Which reclaims ante Class Pexson? oe Memory fs known as Gaibage Colle it CselP, 2 292): def nor =k 30 back. dust Eeif, name = parr FERN beckground cucig 75 ape ot — Fo) ersen(* 34) . mills: Tmnmecltalely. takes: an actfon as Peper eee ei name")) Soon» as object reference. Count zer Setaity CPLy "gels 39) ).- 5 paint. (getatty C pts age" )) delatix € pls “rame")2 je _Methed #— olpl = nae latic Jiethed et ae red ave special Case of — Static Met raccthes chat. belong s “fe ly, PL expeu stoss mein exompie. = Any sFuneHonall ty phe ee Fe place yf [0 class meinads ore 0 wite ‘aiftesent Hem ovdrnory methe INP decor, vegutred! bject TB Placed J IOe 7 th eur tors Laces meinal® ave coud by 0 1089 cel by Sience’sfactoxs} static Met SE. Simtier ste, clase, mectted € [Tome msi oxqument of dose tid 1 08: 001 ne $e erty digterence fe “Phat. Stats a DT foclons mead ot oiy ured for Pony meted .ohich soasnt ad iF Ne«mal -fu® Ri Ingtanholt on iMstonce af _o closs using dyfiecent Noromelns ” they are just BRE Thai Rerogs “1S, class From snose_usvolty possed Ya 4he [O-Ciosaes Sisters w o bosie enhty in objert_ovienied | pregrrommnng inony object oviented progrom the eloes 1S OThs meined allows mMelGeishoper te perform oi clean @ lochuines before theWbjerPTemeinoued Nam memory Dellaxed using ae Keyonva close. every cows anarst These ci@on UP a€hutheSican bELEIsING o Hie o¥ ¥EleoxeT Of date members ond memeds me resources, GRD [B Object - fn object 15 on [nsion® OF close -Objecte av0 The — deiO=— memeduBielefned fo loss ong carved ‘TunKime enhines of the object erienked progvom jcnen speiostnrererence won object +s deleted. © syn1oX SO [Giremeds ona message posing ~ fiebject provides come Service A messoge fav on sbject iG avequest made or _ dei ath GUAT Jexecotion of memned x obloning ane cevUice | Abvasrdestvoctor JO tnresionce- 1 opioperty by abich the new dows Ove [Deke ‘creoted UEING tHe eId classes «In other words the ne o88any, Cow losses Con be dovelaped using GoMe oF he propernres flor ia pen t6 we ly eve wed Tae Fo im jel —ibi — (6e1F «nome: ‘Seif nomeanome [sei — oer — eset punt e Stik nome=g being deere yea lobr= rey ose Oe ject oo iy c1038 C08) 617 ability The. of ine povens eloes- Hence | recossory Fo [det oor ‘amnle ine code 4 #he iMneriionee behoviour LGeGIeS UEING ine o1d losses. INOINES cavds ME new cfORBe con bBiceuelaped v8ing some 01 #RE propernes of wid erocses |@ The sia classes ove referred of base classes and we. ‘Guth ne help of of evomple .eypiaid the signiAcance oF ane wre) menned The cfoss funenan thor be ‘are coiled special Funchens os sei Ng sith double underscore C=) hove speriot The conghodes 4f o clots ie goAned busoispetio! Ancheo ees classes ove veferred gs derived classes. Thot means it xD Tae derived closses inhevit the proPeTWes of bore clos Pig Tmvs funchan ie cond Ghenever aGhe@d|el et Mar close (G The ones to veuse ie e015 Hng_poperne of hove a neva Woke aie 1055 1n derived clo8s ©) Tris type of funened rs ojso covedlad censor Porgmexphrém meons many envinfe iB Ie ob: fe lokemere thon ent fox 0nd *¢REAAAN op €-0n0 evbibiting aiferent benovieuriin dlHesem ine1onees © Ax crompie A ww. efit — (60 Seif nome SpemelOn WY The sehavieuy depends op me Hype dors used in she ‘SeM- mess = MOH. Yo) eperonien:H ploys on impetjont Tor PuNjsijowing objec act aepeycca® OF lorth avéleren internal $¥OCRAE, ty share the same externa). pri0[ Nome: =,gei-rome) inter foce. __ EprinUeuatks.*» setts move) object oviened \pregionmnoses poi Lie some opexonhen Vaie\manher (vstemned to¥ne obj ect Jmexphisiyad would have te create sepora. sis huaens enn ss Srooent Cube" m) iS" st Wehiog) medulemomelfer Coch method [print CStugenn 9-5) 59 -orspioye)

You might also like