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

Python Function and Stack

Python Notes for Functions & Stack

Uploaded by

Hema Chaudhry
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
17 views

Python Function and Stack

Python Notes for Functions & Stack

Uploaded by

Hema Chaudhry
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 20
aia thaliana = ae" Class-SIT - cs. (POD i Chse eas goat) Coon Now (PLACES? Cr Snal fakes oe aLictionoy PuAcls praces aa Mm A vemnenp f Aivplan Aunts (in hy sappevees) 4 Ga placen whese name gue mo Longer Loan & creat, Finls Ssperne? 2! ‘Loncton’, 8 eo ponalf Sia uta old e Leno new YORK 3 = Ports)! newvork iS 7 if Ae pun ar praces COI a coontNov (PLAC eS) gr, chee, Sample Pope (7022-29) ; aw fenurrds (STRING), aohuer Fakeo a Ste ‘<- te a fenwords (STAI ad an aygomnnit falas 0 sespie. cowl saa wd of # Om “do gone rd a Sat is “Come pet us A tre teple Gall have (+; 3,2,/7/3) ef. Lenwenas (srriN@): ip wluin a bist t=O % woerd $ 2 sraina- par) STRING=“ Come Lef us have /sme fou? £5 Reaweras (STRING) pint(ep wale a fr Oeorohs-natptaceC) whieh, prop a Sis A hasaalgr ‘“ Jo be Sesicton 4 TA prumbev exists, 't is 0 = Pruplaced & cee Gscrnal! exit, & cas 30, —- q Z Nombev & Gar RLAAChLol eae L= Lo, 2, 20,2 0] =/0 eS agen ad, Search — place (L, Nt pin doe mate th i Ure rsp for ¢ - eo ip eCe LLC] = o oe usplaga hie apnpeorennor” mew pucat(*Elemenh not foonet Bee wae paages J ar peat (0) pial his L= Lio, 20,30, !2, eo, to] ve ops J wetyaye eat | Dy ou Bi feeb A wha Oh go a Ep amas as oy | |g aan? en? ms x samp inpot (to, 70,3/9 ssc at oi ke’ pe Cl) dy 8h 41,37) ef. coReplace (): fou t in cten(L))é if or =20s Lced > coed tl elie; uoeJe LJ! peat L=Cie) 20, 8¢, t, $57 sad Ew {raul 202) 7 al ba a = apt, Pa SemsCd He sgt wt ose Oa er lea Tn aum (he oie tid oe I” it si fist L_ 1s passent @o C123, '9/ 8,15) — Yim doa funetcen AKintel oe of [23 fg 13,23 bets] ao “ Roar ge ar web aad sf Sl Y Klead, adit, Yatee) E futce dm edd & fet als au cork fa odd MO ef. Daublethe oda (Noms) : t in Noms - i b ‘ ow Ujr~== if Ufaleo: print (iX2) sum= Sum t L&2 OY pois of odd 4 add Maj ("Tastes of ode. Sum:8 Sumy” meen * Nums= 25, 2 E +35, 20,32, 4] Dautlethe odet( noms | gar’ te dupuctinn of 0 moelnoa] fo FcR ch fe HisName” Alu from List Nia meso, and af Tau. poectoor te Pee 4 4 du Nam omlains [Ac z \Kanike § hoo narra, conlaine Tanunoon. dhe fanchon Secs Ahietfiay (ane aT) Cbse com} ; > fl ety af td out | (flames, HisName); eet me "nat ge-(ten (rlames)) if NamesLtJ = = HisNam % mad at( HisName , ‘at’, frien, i¢ fo found == 0 paint(#aie found. ¥) nan =p" Pol’ ‘Jour’, HisName = HisName) findout( Nommes) es kanikal] 4 Name wo hoice - det rlout (Names, HisName)* — in ran e (den ( mames)): ip Named [tJ == HisName * paat(HisName, 2 at’, v) fond = =! / puck. a woah techie) 1S! — jot mat b major slack operation, ; pur . por Apter @ dive 3 orasnerinives 4 slacks hat is a U®@ aula SCTE” | or pemol 4: 2 Snseateon f cutitem eS = ¢ parm Te, Tap The slack e Q. Applca'oes | Boe of UP P Dn ow’ ap baa Sp eon 27 dofix @ eatzin 0 5 pope Eye ve exresnsaT” siock . = of 4 Lage een slack Ale Migaoul GB bvoplow) Last und flew at” | dale af um y) makePush( Package) anf & aul P rreatep(Pectig fo adel a new fackage a. package a Lat reper ilury, Den act ao a Pael & Pp “4 alack. oak SlisetZe eo es aKa. Purr, (Pa ab sap (Erie. ap DeicupeDr:) Package appenct (a) moalePepl Pactege): a ip fen (Package)== ee te pack \onaaptoro Cece”) Catt \petelid element ba, oe a bey) ATic_stkK = CJ ae, ais ghee elemenD stu-Stky Shroli cr) Wee R sick, ee togato in opu_dick. ite eee wd 5 meniet= 7a 80; goal stu_Stk- appenc (sic Niet sve otal def P ep—erements (ala gtic)! Pai “ pue weve mee ‘ jn siu- val= stu_stk- | Bye’ unt( val) pe pl) | Ew ee lee: — wit punr (“slauk ig empty” | wee in na Ja diel 2 rane Push. eLowut | Stu-stK, pe Aiet) a Pep- elem Na- srk) \p Jush rrrake weve. rice is Sian BP Ak rerio nuke stk= J of ter AFG fusn_elements( Cosmet cs) ; for cid, furce in coomets'cs-ibemSC)- ip buce p= 130% cosmenk _ Stk. apperet (@id) oe Le Lew(cosmea cs. stl > 0% peint (cosmetic stk: pop) ere? punt( “slack is empl y Ditom= B* face boah “7 105, * facepack “ 11S, YOhacannng ale: 30, » Pacemoak “ S7 teenth Di : Fancast as is’, + Jor (coset cst) Pop- tne) ee ad Ano bor Lek mehash hoo ola & w Need 4D push. ote whose city is Dae Po bavesck well dr willvunan 2 & Nove 2 i tered veces =/"J ee let Push elements (Rea) ¢7 ™ +p oy . ol econ ft) iP Popelement()/ : ye rg 40} print (memenia. pepo aa gf be ao Slack 8 paint (slave. is emble °) Rererd =[C Rahul’, ! Ce RehiL~ “elements (Reet) 2, ‘pet ], Cikoale’, ve uy," \mondsad ] Ges HX fs i. r LIP ord - last dx First Out a {ao} dinsel je - pp 4 t+ Ca, 20 80, toJ L-pepi) a A’ Twe BN Sink is u® — Twe p) Taw pos eaael of B® olen WE Rant F¥e yee wor eee \ bur R 1S AC * AS | y , t | Arrs [as 56 56,23, 2065/5029 | Sfae=CI ae. pusnCarr). fe tinder: ip cp seers Slacks apperctC o) ip sfack 2=CJ: punk (ssfack erp : 2 ole: punk (slack) | pus oD) "tat if ee a A Ra “v 2 fares atin *\Hy onda 'Nexon’s| Taya’, Sofari ig Th04 : cone ae et Push Yenuele ) $ for , in Vehwele $ iP Vehicle [key]. upberC)= =" Tata’: Slack.a dC puint(8 four) ms ‘Y Push (Vehicle ‘nlecon’,’ Sofa] i sail s in gt bur 3 DB net. - fou C in nang eC tem(lack) -t, 1-1) punt Y Slack CoD : ao Push(Vemuee ) ee] N= [SANKITAY “NINSH’)* ANWAR’, ‘D1 mpLe4' HARI RAT?) onyA= LI lef, PusH( ND | | fi inn: ip SRo in b . onlyA. appen (L) pear (Onlya) A popp(onlyA): while Tove - if onyhe ccs: (' gap ty) ae oan oe posn(N) porn (ona) [ae Nello, 5/3,% 5/4 éven=0I ctey pusntven C2: : ia NS ie Fe ncn oped w poinrl Ever) > Cio, 31 apernl EVEN): oF P att Troe : “\ tho

You might also like