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)
88 views
Python ? Handwritten Notes
Uploaded by
Alex Wez
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Python ? Handwritten Notes For Later
Download
Save
Save Python ? Handwritten 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)
88 views
Python ? Handwritten Notes
Uploaded by
Alex Wez
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Python ? Handwritten Notes For Later
Carousel Previous
Carousel Next
Save
Save Python ? Handwritten Notes For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 73
Search
Fullscreen
classmate if = Guido yor Rossum Syntox i> - 19a1- inaport pandas as pd- | PADGA PrN [GOge. applic xtions -! _ AMAIA, BAKING Machine leaning, | Basic voulables: Data — collection of the pacts. Ex! My narnne js poornro » How to stoae the dato " Pooana! —> string | S56 Tega Tane|folse —> Booleaw | variables. DAtA VAIUES corre Stored internponnry > StoAmGe Spaces called Variables: rore atbh = 30 -.~ ws 32 04 a-b =-IO0 multiple oprahons: ! 20= 6 Il. akb 2200 onvorlables alo = 3) vecisiorn Making statements: | 82 ig else HIS AW ining : ‘ <4 gO 0uUF and Play _Sit Instde iP else MOUKS > 10! 245K _ give pracice test Get ice -aeanw. « : ip ~~ - else pseudo code ig(Conditi on) £ Statements t be execrted?[wor ny oe | ave Used fo sepeot AtASK none Himes. While, Repeat; Erch« _| While loop pseudo code _ |_ While (TRUE)S, Keep exerinting, statements | a8 FPanctions in PAD g Lnanniin gy 3 Function is Ablock fcode Which perpoums _aspediFictask: OOP concepts. | Toe suMounded withthe. pejects Mobile, inptop, bag bike, dog, cat Object have | Paopeaty Behoaviow class is @ template for Aeo) Weald entities. ees paopeties Behaviour ecole al __ *AMake calls x cost KWe cantext *KBEhav 10 WE * Watch video %® Play games "CODING BUGS | NOTES GALLERY| Object TLhas o Specipic template : _ x objects ore Specific Instances SF ACIASS Phone WWld be the Jass 4x specigic instances Would be the objects Baands oF phone Apple 4075) Sie SAMSUNG Nokios google. pixel Tesi Appleis the brand sf phone which iS object op bIW -objects 4) |e! Or t All having. Pack DIFFRENE valnes POA PASPAAHES DIFPRMent valnes For Behaviour > 5) AIQoAltamic OAPPAVACK fo SWIVE Piablenr + Step by step apprgachy ViAGOAG aay {0 Solve > problem is Known AS* Algo aitan input —— Steps to be followed ow putHumber ¢ i fesso, / ( Nunsber Tp aAWrAben Lhe odd i : i || EG gral 4 | Wadhivad t.3-—Q0ls vee: betAcep aati aaa LNA QOL AL $a ON Seth A " Sie a pageiaies 6 ae = _sa Introductory to pythow: Fraeeand openSoUce Ks preeto download and to 4 Patho mae-coding init 7 a \\ ¥WE COV AUK OWL Code Trany spine 0S platpoa \ igitis windows, MAC, LINUX TT Sottect oriented * BY using trrobjech We ‘ car get Solmtign por Hit PAD frrge Standard libro, THPAOVIdeS MUCH. More §AQKIES Which, we Le inneed DDE - Prteqrated pev OPrnent Envidonment | Pathorn Pacha, Ano conda, Webpage pishib as 7% ~| =) I i I | Painst(" This is pooanat) Trtao to Jupyitr notebook + kernel Cxecintes tre Programe: Ts ispooanoy = Variables: , HE tom OX ="Pooangn! 5 * Voninbles and Datov-types in python» os = | i] w ‘oa is~voriable — — Pootnow HA =Nchandanr" gas w Le > chandaw DALE A=" Gowda’ | iw 5g So > Gowda Datn types im python every Vooble is associated Wit thedatw dD tnteges (int) Tnrege valnes USS iga 1,243, 4, S; 100, 1000,229 Floatx | a) = 100 Lal | 3 100 “type (a) Sixt i x) AL = 34 al iiegid BALE Balljod = By eypelav type (3.!4) — Float i* Se J Hoat #|| al = Tne k au al J Tune ‘ o> eae +ype(a) => Bool # | Al =" PooINnall al J !Pooann! +4pelar) 2 Ste x Complex Nurnba- Botn Real and a Fr QAl= 6ta5 SEAN PE al| classmate || Ratt metic opi ntos ReIAHOWA| operrntor logical openctos. — « % ¢ i | We can prporw vartous types oF Ope | bg wsing above mentioned operators. Aaithmeric apernpor A A=lo b=20 Axritamehe on Mathematic operations (4, = 7 *1) Atb —> 30(10+20) a—6 —> -0(10-20) | bas b-a —>_10 (20-10) eb 3 200 (10%20)_ a8 —) 6:5 (10/20) > We Showld se fpounond slash Relational Ea | 0>b —>False, b7a —> Take (20910) ta a
logicaloperator "a — Bitwise parator "8", wy _@ And opehntor _a=tane (1) b=False (0) i Lagb — False whartt+ne and oparctor bAn —? False weger A+AAe VAlAS on bab — False When batrtheoparannd SO AAA SF TAME _ Paine (yp shoal | 0% operctor ¢ Trwiligive Wsethetare Aesult When 3 | | eltnen op the operands is tare 0A boty oF the opehands are tne a q We will gera False AeSWIt wWeket tre | OD OPUATO only Wherv both the operands ene false a “i A= Tue (1) b= False (0) ; ea ft. on Alb —> Tune (either one valve. having bla— Tawe (ais Huey Ol) shag = AlA— Tne (both the operands AER bib —> Faise =classmate. ——_ + __ CO), Tokens in python a — |_Srneliest Mensing Ful Con~ponert in ov proqaarny, = a _|| Keywordsivor) suite set ~__ | eaentpiens || Literals | operators QO) Keywoads a — me Special aeseaved woads tz os || TRI give Menningewl Dnfoanvextion for the Compiler or Trteaprertenr. 3 y i False class _ Finally is Return None Confhnne For _ lambda TAY . ar der Pion | Nonloca |! While _ and del Globo} Not . Wi, AS elif pats Om 6 gield @)| tdentigiens. zs | KE NOMES Wsed For Voniables, puncHons = - q or objects Rules — : No Specin' character except — (Identifies) TderntFies oue case Sensitive. Fast letter Cannot be adigit E Poor iS iis DcentiFite ce | _Poorno is being rdentified by Wis name CODING BUGS | NOTES GALLERY@)| Python literals = Constants in pythory (peneh ches Al = "Pooanc! brs a SHIng liternod x Latisavoriable : A= 123 —D Numaic fitrant < A= TAAL —> Boolean ji HAL % Staings in python TP ME Seynence OF CharncraAs eEnclos Within Single quotes('!), dowble ave Gs ox MEIES qwotes (Mi HID "Hello Woald! " This iscpoorna" .. Tan Going to KEADIA tomaAnoW Mt b] =!Hello woald' bI— THelio Word! « bl =" This ts pooANK" bi=> | This is poorno bI= "This iso muitiline. StAing Ky)classmate “Extancling+he Drdividual CHORACHAS) de ——s é _Trdexing in pyrhor SHAN With 0, Rob ln 012.3456 489 012M Is 4 _My- Stating = "My — name — IS — P00 z AE ASH B=(2
nome sis ei Now T want poornow my-staing (1114) >! Pooanay ae St J* 290200" reno sting) lHReplacting | A SUBSHUAG my sting waeplace ("ya") —'ma name is poorwre. i NUrmnb er of occ uweirences oF SWbSTLING- New Staring = "hello Hello hello World" hew-~ string, count (“helio'D a 5 Se Finding the Index of subshtin g, ViilN 21 ARS S\= “TWis is Pooarna! St Find (" ie y — B \ : te SpUHINg a sting. Fawt =" Lifee applies; man ANGO eS) banano. Chemies"! i Patt. split(', ") eC firiice apples’ ‘Mangoes';"banonc!,! A@ Tuples in python aa classmate, ——_> ) Sote (7 Page ee Dortov “Stawmctmes inpytnorn Uist Hi DicHornony _ set [Tuple | . 4s ar oadered col \ecHary oF elements enclosed withtry () * Twples are Innmutable a} ONCE You cAaeate the Maple, $4 OUAE BARDEN | the vaine inside te taple ¢ * Heterogenous mixtwe of diffuent elements: HETuple = ; © tpl = (100/"b', Tawe, "cl, False) - tarp] —> (100, Ie!) TAne, 'C) False) | type (bup)— > faple: ‘ y Extanct Individual elements ‘ aml +upilo] 100 tupili)—'b' tupif-iJ> False { chercitiallinds apiliig]— tb! ave 4api[2] —= " hello” We will gerorort haple" object doesnot SUpPOAb ten assignment ,Finding lengt~ of Txple fupl = (100, "bY, Tare, WC, False) len(typ) > S ‘re Concotencting Faples a tpi =i2is)) = tup2 = (4516) I tupl+ fap 2 (1213, 4 51 6) Repeating Twple elements tpl = (!Pooana'!;300) tapixd = (Poorna', 300, 'Pooana, 300,! PooANa!, 300) | Reapecting and Concarenahing tpl =(' Pooana', 3005 HapintGyis76)>"snaT lala Auplt3 + tupr : os) — ('Poornw,300,'Pooanc; 300,'Péoano! 300 Tupie Funchons. Minimum value I apl=(12134,5) min (typi =! VATclassmate. —@. ies in Super Ist is an ordered collection of elements is | _endosed within D3) |__# lists ane mutable We Coradd, Snbract, multiply. values __insidetne list. LUE CL "Poona, 3:14, Trane, 5495) | ee Sst th * leanunee Individual elements | (ub sai. ; “| ulitu) ['pooane! 3.14, Tare) * Modifying alist Changing the element a oth index all lal. 2 Mb 3,"cr] | SieeenBios) = 7aL00 Uae, | RRR OS AY 2 MES es Appending anew element =e fiat 25 lb", 3ed) . | UU. append ("pornos c a u ' ol SS [1la!, 2,'b', 3,'c! 'Pooma) + d | Popping the last element eS UL tay 2, "4 3,0") U. pop) ul Sigiees 2)Reveastrg elements [= fitay aitby see uy. aevase() u — [tet ib) 21 Pe digit Ce Trsecting element ora specified L=L ital) 2M" eae Uninserct (1, "pooanat) 3 C1 lpooana, 'at, 2,'b' acd Sorting alist w=" Mango", reany" "banana'',, Lysoat () a i concatenari 9 lis ts , u=C1 239 oi ‘ he ef NAMA", fe) Vé =e Y+L2 fates aye’ 2 3 AL, bY, kel one Repeating elements: U=Liia", tured LAS > le, Bue, In - VIO DUR, | Tat,_&| Dictionary Inpythor | rac genta) || iS an wnordered collection. oF aes valine | paias enclosed with So |x Dichonoay is mutable ‘ ' lads | Keng PATA A 5 VAlne ee paurit =flapple”; So,"bananali3o "Aang e!'4o,"peoch": 10g _| Rape(panit) dict * EXHANCHING keys paurit =flopple!iSD,lleananall 30, sonalegentaeemie 60g FAW vkeygs ( ) c = dict-keys (['apple!, oannge banana’ qnowved)) KEtAoctngvalues : : ia parit: Sopple"s $0, "bonona': 30 Nonringe': YO ,Nauowa" 603 | fanit.valnes() io, => dict values ( (50,30, 40,60]) Purit. items I> a! 5 ‘ dict-item S(Capple'S0)( bananal3), (orange!,up)) ('Guave',60)))Adding anew element —-— gautt = apple! 10, Wonange'!!20, "BANANA! ‘305 FaultL mango} =So : = Exnit — ) oa LlApple'No/'oramnge':20,' Bannan 130)’ MAngol: Changing an existing element pauls "Applets 10 , VoAmnge" 120% pauit [Apple] =100 Puit— 2 'Apple!: 0, aa ge!t 202 1a ix Fauit! =f" Apple's 10, orange": 208 PAU? = PNchomy": 30 "Banana"! Yo = PAWUits update (panit2) Pot) a? PIApple'i!0 , !oAdnge" 20, chery! 30 ,'Bananaltl Popping Anelement (Removing ) paurit =f "Appletito "oAmNge": 20, "Banca! } 3D faut: pop(ornnge") fiwit — > LT Apple! (0) ‘Banana! 3p.| set ts an wnoadered and unindexed Set In pythow > colilectiory oF clememts elclosed Witt ia & pupiicares aie not allowed in set S1 = £1 !Pooana!," Pooana', eT Elias. _ 31, "Pooana Wie Cor see, duplicates are not allowed in set Set operations: See x Adding a new element S1= Zl", TAUe, 2," oN, Faise % Sladd(" Hello") S\ LUZ IFAISE/ Heo IAL tere 2 Theis ho prOPER Sequence inset So +he Indexing isnot possible insets, * Updating Multiple elements {ff Si= ZI ta", TAME, 2,"b") False Stiapdate (C 10,20 130) Ss) £110, 220,30, False, lo! vos ® REHGD VINE an elementSet prrnctfons: VOTE 7 oni Po snd ated wap | Union and DytersecHar So aysud ibe Bl ig * Wor a SNe $2133 sas Si ; S229 haw MN tery Basically Gncrtennting. Siswnion(St) —> Wo Sets: 71213, la! Ibe! 3 Su Bis | * Dntersection & xi SIE $1,231 y Se Rnade STyopimd ont Remco neRnee S2235,6,4/8,9% elements behween two Sirintersection (S2). = Pets.e ci 2 nue isc} ge tania Wasthund sap SA ot trely Guy|e Statement ig its ANning Sitinside | else ao outand pli I @ =10 b=20 ig arb; Paint (tovis qreatrthanb") z : cul pipe an oat BES: PAint ("bis greater than oar) if oobs EF pa PAInt{ Ais greater tron b") elsieny PAIne("ats not greet tron b") Ran ais hot grenterthan b elseif 3 We will welt wher WE Want to check ype mUltiple Sto| c=30 Cou | ip(@rbandg vo): a paint ("ais thegueatest'D § j lelig (boa 8 b>C)! aa paint ("'b is the greatest") [elses F 2 cde eee paint (" cis greatest ") last jb at TBA, Te isthe grentese OOltL Ns Gis Now Can Seehow canwe Weis | Conditional sintemen's with, Ust, Tuple ee dichonawy, tapl=(/243/4) (Git MPD aa Lip zin top: PAint(" 2is present in tuple) ° | = ae BAY zis present in tuple a hale 3) tapl= (1213/4) , SDs hl ght oa Life intupl* paint (“6is present inteple) cise paint('éis not present intaple") Bur y ¢ is not present intupleAS ed r ig uCs=2- aoe i uf'J=upj+i0° u—> Ly, 102 3,45 i *) U =[2134.5) ig uCyj==!0% ie ufJ= uf ]+ioo elses a] uly) = uLy) +500 ee) s[vt023/ 41508 J Tp with dictionow eld = Os HED 3y te diC"bYJ ==2: di[tb"] =di ["b*] +00 dl — flat, 'btndr, (o's BR| classmate | 5 cae) aan) | LOOPING STATEMENTS ZN PYTHON: _used to Aepeat a task multiple times, —_@) wWhileloop= Ot Hs he ad {ent while loop | Syntox while condition } J | Execute Stattments i} «| f= a TWhile TeI0; 4 = l Paint i> é | ea) pas i -g— a BS = __|| NE2 scale > BER While i<=lotos 9 2x5 =10 Be | paint(inv "RE" nxt oe 212, | ie Dk =p a : P 2x8 16 a wr g 2*9 218 ¥ A “DX20= 40 - DRID=: ¥ a*) UU = (123/92 t=07 while i slen(u): utid= ulid +100 icitl u—> Ciol, 102.103, 104,105 J FoR LOOP used £0 itewte over m perce (tuple, list: dictionary) Ga ia in Sequence yc wbdy OF POA, key word a d t= (lope! "eanana'," orange Fort inut - Princ (i> : > Sita ee tele bananc OKNAG —, nested for loop = [Norange e" "blue", "qseen!] - 5 EY aha VeRoiae ‘phone*] For Tin: for dinizi — 9 ”RNgE Book 4 palint (1) - s blne book ~~ bs NE .Basic problems in pytnory Soe _@ check ever onrodd t i Aun = int linput(! Ente anumbert’ ")) | ig (numa2) =o". VAD REM oInd ee / paint (num," is even") se Fids [elses G x PAINE (RUM, Mis odd). —) Enteranumbui Si) | Sis odd 9 ERR NAmb 8 gis evere check positive pr|eqgahiv e@ on0 num = Floot(input (enter ANnUmber + iFMUM 270 + ‘ paint ("positive num!) elif HAM ==0: iG PAiint (# Zero) eee ] paint (tt Negative nuamb et) — BHher Anum! 8 Positive nuUmbUw ar mo} Bro — Entern numbeni—S Negative nambe.Factorial opa number: AWM = tte (Input (HER nwmberi 1) factorlal =! ip nann
Noamal Prncton P 2 HAG | Lambda function ; OOS VS ee Normal function Sgntax dep punctionanamet o>) 8 6 96) Execrte Statements _ | Lambda gunction syntax Lambda arguements | expaesstorv @) dee helo os Hey Abana) |___ PAint ("Hello woald") | hellod) = pello World ss 5 © _ie Gepjoddioe>: : AeHAY K+10 eqn oad (10010) fis x 20dee ever -odd(x): ¢ Ee 2 ig XK22202 paint (x,."is: Eve? else? Paint (x, "1s add") J even_odd(s) Sis odd Lambda fianc Hons: (Fle AAP: Aveduce) = B= lambda kK: x#x*x Paint(9()) i ws 343 MAIN functions of lonntoda opeawtions 3E lambda puncHans with (rites) TOES foie Panne! Ga[ 5), 22.194. Sy 62, 4123/5361) 0 Final list =list (filtta(ianbdax ! (x%2 120) y| i) paint (Final—list) IS EXHACHING He a Wumbas. [Si 314% +71 23) $3) 61 J =| PAInt (gina) ist) |— — coh aed (| Cio 14 G41 Lo8r2y, ISU, 46 146, 122) aL Ge [S112 9F1SU, 62 AH 23,43 61) Finalist = list(map(lambda x1 x*2, 11) * tambdoy withaeduce. W=CS18 110, 20,50, 100) Sum = reduce ((lanbda xy! x+y), Li) | Paint (sum) 5| object oriented programming) =) ee | OOPs ine Pythow: ees we one suxromnded withoejects _ like (mobile japtopi bike, key) pein, dog: book) classes i- Class ISA termpinte for Aealwoald entities - a class | Atalbute|Propextes Behaviour|Methad. oF {| “i Phone | PAoperHes Behoviouww q _* Colo * Make Cols ll COS *AWatch videos 7 1 ABattery li pe as Play games Classis AWsea defined datatype +. b tris adatahype Which we can Create oy ourselvesobjects t= aq ees objects one Specipic instances oF & gece L ie bile) > SS Apples wi! TSowrn _ipprent ; = il class baands v E objects SF freAS SGI Piast Classi snob tenting a class phone peed class phone + : dReprencirg wa __4eF fe als a paint ("making phone call") / dep play-game (self): Paint ("playing ganne") Root Pi = phone () Finvoring meineds tongh object + NIESFORjECE y nowne of the: Method | Making Prone call’ | pls Play Agomeria gahion!) s (> Plaging gamers Adding poarcametus to a class method __class Phone * I dee set-color(Selp, Color): Selp. color = color dep set- cost(selp, cost)?» Sep. cost =C0st def ‘Show colon (selp): ACH Sele, Color dep Show-cost(self): ae Hun Sele, cost dep Make—coli(selp): > aoa paint (“Making phone call\)9 3.2 def Play-game(Sele)i print ("playing game pr= phone() P2.Assign Po. Set-Color (bine!) | P2+ Set—Colost+(s00) P2. Show—Colorl}—y bine!“creating o class with Constanctox - class employee t s03 | deg —-init-- (selp name, 29¢-colaugoae a nny gender): Init method acts 03 Constunctorr wv | SelBiname =nanve | Selpage >AGes 2 abi an Sie selp. SALA = Salm. ce = Self: gendw= gender def enrployee-detoils (selp): Punt (Name op employee is | seipinanme) + PAINt (Ag eof employee isi" selpiage) ____ Palin (Wsalony of employee 15 SelprSoveng) PAINE "Ged & oF employee is!) Self. gender) = Erployee ("'pooana!"', 23, 100,000, Male) - | Vinstontiating the "el object | Elremploygee —details (2 Inoking ‘employee details" Bacio ae = Name of erployee IS poorna- IL age sferrployee |S 23 Salary, of emrployee iS 100,000 gender of employee is Maleeee iL_ class vehicles | ee Selp. mileage =Mileage ime. class cary denive. | T With. Thheritance one © the paopeties op the arothel SASS + deg _—init-—(serg mnillenge (Crst)2 Selp, Cost = Cost : vs dep sShow-—detalls (selF)* paint (tram avenicet) paint (mileage op vehicle 1S" Sele mil palint-(1cost of vehicle IS!) selps cost) _VL=vehicle(Soo/s00) ! { Vis Show — details CD Zan ¢ i : Jicaues ; Tom avehide aia Milenge of Vehicle is 500 COS OR Vehicle 15 SOO > < oldawse ig“#F Geating the child class - tal gible va ve class coartvehicle)? 3g Nn zig dep Show —car(self.)s t PAind("rawe acon). 5 a _ | ct eca(290,1200) > Tobantioling dhe objec __cheshow- details) fordNid class | Tom avehicle { mileage oF vehicle. 1s 200 a cost o¢ vehicle is 1200 Ch Show cord) ae. TrvoKirg the cHlid Tan a coe Class method V8 aeover -Aldtng init method: © | Class con(velnicle)s dep ~-init-- (Sele raileag e, Cost /tgkes: Supat). init =(mileage cost? Uselpntyaesi= tyne’ SelpsAp = hp def show-Car-detuilis (Selz)$ r paint(’ Tow, ovcowl) A PAIK ("Numb op hye s one", Selp. hyxes paint (ivalue op hp is”, self Sp) PiNvoKing -show-detail sO vA method Fiorw ponent class El = UA-(20112000 74, 300,) Cis Show —details() — Tam a vehicle Mileage op vehicle is 20 cost F Vehicle is 12000 Finvolding Show cordetails() method from child class Cli Show.cor~ details () —> Torr A CAL Number of tyies ove 4 valine of bp is 300“Types op Damitonce ai Single Traheaitance Muttiple Banenitanc® ok 1 MLL = © multi-level Dvrenitance 7 NS SS | bgbrid prheritance | Mwitiple Trhedtance. Hain | The child innenits Prom Moke thon | |PMENE CASS: class parenti()i a “ def assign—siing one (sele.SH)4 - Selpistals sya ~(PosenFe “dep Show-sking_one (self): _ | Aer Sete ste Class parent2()! I def assign-sking—two (Self 5-2); | Self iSAL =SHZD def Show-shing hwo (Sele); (Potent class 2) + Aer selP, SHA j ___ Class derived (Parent 1, parent 2); | def assign-sking-Hice (Self, sk3)5 = Sel F1SK3 =SHZ f ____ deP Show -SKing —tHee( Sele); | Achww Sel p. SR3, sales _ 2 child lass © creaking He Objector the ! | di, petved dlrassign-sting-one('one') : cll, assign - sKing -fwsd (itewo"D dj, assign - shing-+see (IHrtec!) Troviing method 5 ERS oHia nel. SS tone! dhishow —Sking Wa — > ‘hwo! dir show ~Siting-taeeO) twee!Mutt -leve) raheitance Wehave prent, ctAtid and Qaandchild Relationship. Powent 1B Tthoaveboth tne propahes of Child and the potent. | Ponrent class | class powent(): 7 I de F Assign name (Selpiname)i I Selpinanye =hname | dep Show-name (sele)i | Athan Selfrnam e& child class: {| “Class child (Porent) + | deg assign-age (selp, age); Selpiage = age dep show-age (Sele); achuiry sel page | Baad child class | class qannd child (Gniid ds | deg assign-gendu(self, genda)s = Self. gendu = gender fa deg show- qende (selp 1 7 ACH Sel P. namegle ch gaandchiid (> | Ql assign name (Mpaana? Ql. assign - age(2s) Qrassign- gendrcimace”) Trvoking class metnods © Gi Show —nam el) —4 Pooranor Gli Show -aq el) = 7 mas : dl. Show - genderty i! — male- fontinuation oF pytnon— Eemragts "__@6) ARI Tin Python « | iPwe have int adoy, we should only hove All the Value oF Sanne hgpe: Int coho, ip We have plont anny, We Showd only howe Fock ossovy = eS om innpoat May as or OX, (aD t-signed integer (-\to Flom adrorginnport x T-unsigned integer vals = osnom('T 4 (5,9, 81421) PAint (vals> PAINE (Vaiss bur FUKinfo()) — (addaess,size) PAint(typecode > i — He one Woaking With Integue PAO o8K2y Inport *& vals = asrong (105, 9-8, 4,2) Vals: aeviuse ( > paint (vals) 9 oe C7 [24 = 8, eg) Vals= wo 05)9,-8,4, 2) | Fort in aonge (5): paint) aS. q —8 i 2 When we dont Know the. Aminge $0.21 iin Ange (len (vals): paine( vals[ iJ)| pore in vals + a ¥ tases [ 9 goes paint(e) 1 os 203009 409 Be nae (ik Conwe Wolk With chonackeue wre gatas U- Unicode 7 “ « Pion Ao import * {wn TSO 63 ze |_vals = osay (ut, Cattes itd)
ae peer bit TA gelesen ae xk | Tp T Want io aeate EW OAD USING Pres old arom 3°) nga Se = ry br. vals = (Ci C5.9, 814,29) LteF = : a HEWAL = ALO, (Vals: hgpecode;(A Por avinwals)) _ fOA Ein Rewaus _ (OR POA. irs vals)) palnte Me aonb While i
L= L123 JPA ALY Whos is, 7 : | Compile time wip —9 a = hello" (PAobien—~ insy logicnl ener —5 G+U]2 (Problen~ with! Exceptions + RUMATME BADLS AS Exception es | Thee isan earor scaniing during the | CXECUHON of He particular 4ask i Exceptto nw handling + Kegnioad s = EA i except : else: Finally: ——— tay Contains operations except! What has fo be done WAIte that Code Ke. Tgpes oF cern Di W/* = _S, 6. "PooANna" Valine PIADIA= too PANY Valtnes bo enpac ®) t=0,2,3 u[u)b=lo | ~ wapoate pooxnow : 3") Yonge aaa a =0tsial je not Fownd eror)= reat ned esa 2+! 3! Veil «bil ANd ah Gey Stee lal Rape Ako) | ee opand Pape spo, t Mint’! and ist ‘ br A) Gib on és 2a ) inApoat moh 22 ky a dPentr hegelve rR oy chedlke What happens ume int(input (fener numbtr to conmpubepud & rns "OD worvmish ips Seka sal =cmoest Aa\ a. jexcepr vAWemor) Gs oy se ak Paine(math: PREG nea. anal PAint (cannot @mopute the fochosiol oe hegehve humbns'> ei ee ee wolal "1402! igen” pel aeLinnpo wt note “num inet(input (Tener no fo Compute PActoun FE } Valid input = False : : While not-valid ae tanes > Paint( Meant Pactorial(num)) Veniid — input = Tae except Vale ero A 3 PAINE (Ncormnot comput e the Porcfouiarl at-hegahve nos! A KAM = Int input ("pleos e xe TEA; 3) Exo def PA getmonth(): month = int input (Mente Oareint Monty(i-12); Ws ig month <1 on Month 12 AAISe value. 20 AE ACHALR nad AHS valid = Frais Montnnome=("Tan! "pe trrondy "ap"! 5 "Tay" Sang", Seph ‘Iniov! oa While hot Vid wai Mont = getmonth () PAINE (TR monte yor entered i 5!) 5 Rash — nO [ont - Valid | =Tane- wD except Valmeeror + - Print (*grvoid mopar orden’)i classmate. \ _@ pro" Lon. - | dee vont I Momth =irct(inpre (Gren Cuarent: month (1-124 >) i ip mons
tg | i except Excephiorms 4 i paint(") iss excep t PAO DIVISION TOA} Paint ("2DE") er) [pass exception} pemcep ae ES EDEN & Bosecrcephor ei + ae] 4 @ | Te else part will Keanted wher ERR 1 “beer. equngnr4) Beat = QA=5 5 ion ts b= 5|5 e) | excepr 2DE! SF ca purt('2DE") WG AIS GH __llexcepr Base&xcephian; é | pant Bev a lsxcept Exeeption : | paint("E) - else: ie PH" ELSE") —— tng ' Gy_a=s 1Ra3 daa é i" i b-Slo enti UA OR EDAD 40 4: ih | except (Baseexception Exception 2eropivtsfanExrBAa) 9 a $y | aS b=s\|= s except i puntty! | aes ead b=s|o_ Cook -bisigan C > excepe except Salt les Ss CALGA~ PAine(? HID except oVecooked exLnrA- else; _ Bnalhg: PAInH( "Hello" Swithop-p-SPove | Biraligs Palit (NamoasHe*) When tre is exceptim id execerkd arret Firelty will be axearted, {end — of excepHor hand! Pingor Way < 5 TF Creating AnOys in NunopY) [7 Bey IinespaceC>, logspacec >, “| asangedd, Zeros C2 ,onesC).... From nunop inopost ae a c= wy (C1-21314 50) - paint (2) | ||
Cay wt] «AAA awh aad Ci) ot Lon Aah COA) Ames) pal DA Oy BARD Chai, Lips aT WDy'Gy copying enaunng Kpgthory a g @ frore nawpyipost Low sou (12,345) AXLE ALS A —_— |PAint (our) _j3 [e+8 910) eS vectotized operation 2 PROM nuampy import * A SoM (1, 2,315) MAD= ovrory (Csi413, 21D OZ “AVI taun27 Paint (ond) a na — (6. 616.6, 6] = “Gia ani @ Mathemation| opeLahions In Nurep+- Fim nrepg import ® 22 50 au Song (D1, 2314, 5) 1 i | Paint (ANID AS 4 | paint (log (Am) : io Paint (in (oan) [paint (05 (oni) | PAInt (SA F(a) paint Gurr(awu)> pAmntimin (aw) [ paint: (mow (Awu)) | wnique, sort @ we canalso cancorino-< from nuvepy innport * aw = (01/213,4, $2) aur arr gC 6111 3,239) InE( concatenate (Tar asx’\ ==) ]_ pron + Ae raponees + ‘ awe owncyy (0121314 s)). ; a AAD > Or! view @ y)% 7 paint(Ant) i —| prt (OUAL) | | view i is a punctionw thar GES New Aro + 7 i Shot lonnCopy t iba ‘ The bon Ht DLO GRE pe 8 tA Bom iano Psy xk pnpoxt Ont = oro (1216) WZ » his ae OWLT = ALI view) “oi = its ' ant & PAIne(CWI) 2,4, 8, (mer PALHt (AZ) 21:9; 8, 12 __ | Deep Copy The_both the aus ane not Inteinked © | Blow nuwnpy inepowt anid veel [awe oy (C1 21314, 5D i r |AW2= AIR COps Gdn ge Okun ds idan) OF Be ! own = 4 [priv (QUHe) Sy 1/3 ry Sib gl yeni ora _ PAI rt (OA D)-9 1,21 3, 4, 3 "Was any 7 CREA pt | Aha SE aa 1 Is 5 te SL 4 (Ema possi il :en WAKING with Matix 4o4 en [PAO numpy Inport : Ta aunt =anoy(C vi Ch2 3) Tl C4.s16] D Print (aw) ‘ ai PAINE COW indin) — shaw the nimop dime Paint (OW Shape) 2A9W3 @lumnas Print (QUIS e) —5 6 (Counts the siZe) ik Ewan to vente 2d omovy jhto a @) hom
Cl 4 a}. paint(miminiy— I Calan) Fest PA nt (mi mox0)—9 BANA BOM boop aie Aon nur inqpo Ak isan aha ee mal =Motaix(') 235 6 45 4 167! mr= mataix(11 2.35 6351 264. - M3 = Mem? 5 Dros PAlint-(™3) 2 Srv 25) tae {5A HADI WAA 2AA) pee MAN DN MOD Ft ct F "
You might also like
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
From Everand
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
Mark Manson
4/5 (6125)
Principles: Life and Work
From Everand
Principles: Life and Work
Ray Dalio
4/5 (627)
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Brene Brown
4/5 (1148)
Never Split the Difference: Negotiating As If Your Life Depended On It
From Everand
Never Split the Difference: Negotiating As If Your Life Depended On It
Chris Voss
4.5/5 (932)
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Jeannette Walls
4/5 (8214)
Grit: The Power of Passion and Perseverance
From Everand
Grit: The Power of Passion and Perseverance
Angela Duckworth
4/5 (631)
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
Jesmyn Ward
4/5 (1253)
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Stephen Chbosky
4/5 (8365)
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Phil Knight
4.5/5 (860)
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
Carmen Maria Machado
4/5 (877)
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
From Everand
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
Margot Lee Shetterly
4/5 (954)
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
From Everand
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
Ben Horowitz
4.5/5 (361)
Steve Jobs
From Everand
Steve Jobs
Walter Isaacson
4/5 (2922)
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
Ashlee Vance
4.5/5 (484)
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
Siddhartha Mukherjee
4.5/5 (277)
A Man Called Ove: A Novel
From Everand
A Man Called Ove: A Novel
Fredrik Backman
4.5/5 (4972)
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
Frank McCourt
4.5/5 (444)
The Art of Racing in the Rain: A Novel
From Everand
The Art of Racing in the Rain: A Novel
Garth Stein
4/5 (4281)
Brooklyn: A Novel
From Everand
Brooklyn: A Novel
Colm Tóibín
3.5/5 (2061)
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
Sarah M. Broom
4/5 (100)
The Little Book of Hygge: Danish Secrets to Happy Living
From Everand
The Little Book of Hygge: Danish Secrets to Happy Living
Meik Wiking
3.5/5 (447)
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Thomas L. Friedman
3.5/5 (2283)
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
From Everand
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
Gilbert King
4.5/5 (278)
Bad Feminist: Essays
From Everand
Bad Feminist: Essays
Roxane Gay
4/5 (1068)
Yes Please
From Everand
Yes Please
Amy Poehler
4/5 (1987)
The Outsider: A Novel
From Everand
The Outsider: A Novel
Stephen King
4/5 (1993)
The Woman in Cabin 10
From Everand
The Woman in Cabin 10
Ruth Ware
3.5/5 (2641)
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
Betty Smith
4.5/5 (1936)
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
From Everand
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
Viet Thanh Nguyen
4.5/5 (125)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Dave Eggers
3.5/5 (692)
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Doris Kearns Goodwin
4.5/5 (1912)
Wolf Hall: A Novel
From Everand
Wolf Hall: A Novel
Hilary Mantel
4/5 (4074)
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
Bob Woodward
3.5/5 (830)
On Fire: The (Burning) Case for a Green New Deal
From Everand
On Fire: The (Burning) Case for a Green New Deal
Naomi Klein
4/5 (75)
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Jay Sekulow
3.5/5 (143)
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
Jennifer Egan
3.5/5 (901)
John Adams
From Everand
John Adams
David McCullough
4.5/5 (2530)
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
M L Stedman
4.5/5 (790)
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
George Packer
4/5 (45)
Little Women
From Everand
Little Women
Louisa May Alcott
4/5 (105)
The Constant Gardener: A Novel
From Everand
The Constant Gardener: A Novel
John le Carré
3.5/5 (109)
Related titles
Click to expand Related Titles
Carousel Previous
Carousel Next
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
From Everand
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
Principles: Life and Work
From Everand
Principles: Life and Work
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Never Split the Difference: Negotiating As If Your Life Depended On It
From Everand
Never Split the Difference: Negotiating As If Your Life Depended On It
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Grit: The Power of Passion and Perseverance
From Everand
Grit: The Power of Passion and Perseverance
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
From Everand
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
From Everand
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
Steve Jobs
From Everand
Steve Jobs
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
A Man Called Ove: A Novel
From Everand
A Man Called Ove: A Novel
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
The Art of Racing in the Rain: A Novel
From Everand
The Art of Racing in the Rain: A Novel
Brooklyn: A Novel
From Everand
Brooklyn: A Novel
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
The Little Book of Hygge: Danish Secrets to Happy Living
From Everand
The Little Book of Hygge: Danish Secrets to Happy Living
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
From Everand
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
Bad Feminist: Essays
From Everand
Bad Feminist: Essays
Yes Please
From Everand
Yes Please
The Outsider: A Novel
From Everand
The Outsider: A Novel
The Woman in Cabin 10
From Everand
The Woman in Cabin 10
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
From Everand
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Wolf Hall: A Novel
From Everand
Wolf Hall: A Novel
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
On Fire: The (Burning) Case for a Green New Deal
From Everand
On Fire: The (Burning) Case for a Green New Deal
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
John Adams
From Everand
John Adams
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
Little Women
From Everand
Little Women
The Constant Gardener: A Novel
From Everand
The Constant Gardener: A Novel