[go: up one dir, main page]

0% found this document useful (0 votes)
7 views41 pages

PPS - Unit 3 Function and String

The document discusses the concept of functions in programming, explaining their definition, purpose, and types, including user-defined and built-in functions. It emphasizes the importance of functions for code readability, reusability, and debugging, along with examples of how to define and call functions in Python. Additionally, it covers variable scope, lifetime, and the significance of documentation in coding practices.

Uploaded by

Shweta borse
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)
7 views41 pages

PPS - Unit 3 Function and String

The document discusses the concept of functions in programming, explaining their definition, purpose, and types, including user-defined and built-in functions. It emphasizes the importance of functions for code readability, reusability, and debugging, along with examples of how to define and call functions in Python. Additionally, it covers variable scope, lifetime, and the significance of documentation in coding practices.

Uploaded by

Shweta borse
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/ 41
Unit > Q_||_ Define -Fancton 2 plain at || Neect for _funchon. OQ fucction—twith excarnpl =| funchion is block of lnskeucton thet pesos i‘ a_Specifi $-tnell_defined_cfasis-___ ‘This_block Gan be 7% programming inshucton, oe 4 even funthon 1. Specified by name PA fdnehian -rectuces aade crepe tition iguniticad cohich in darn snakes cader mere uschie. 4 Reason of using fursetions dee aa follore ;—Ta_imerave readability pf +he source code. All dhe loa by axelctbect Stateroenl®. can be ~ pregacies 208} cto acenel 1 fanales tend debat : The repetition Bf sip ober ee can be avoidecl by using fudction a Di “uaction -allocs | (18 to debug the paths on, oF a_thirme § then} assemble ther inte ate hole tthe function $s cmriten £ bested we Can euse this Code Reusabelity iS _am_impentant use of Funchin- Type of functions re | B pe Explain dynes of Functions with example (| u o_definedd functions. - ‘These es of Saar aaa User Guilb-i0 iarar — Pee C 4 uggest a there ase built-in - Hence _ As the nam, youcan dinectty Use it 2j= paint?) 49 in python. g potax—of function det function nar ( Pyguments): Docshing" * Matement & Usee deRne function © _Define a funchon def abc) = Fant name defined, Printing of the +0 bing * “ petag ng, bio (" Hetla “ewer ") Functian Call —The funchiim call is Statement that invokes fu. - When a function is tallied the Paograro ¢onteol executes the Statement present io dhe Function body. onze all dhe statements: in finttion ody get Functicny « Quoter Funchan mame () FaSometimes there ake Rome arcamererva +o the function then Hy we hecomes— function namel Avia ft wanabie i ---) The Corgument is a value hak is pa: ed cto the Function? vlhen ik is called AME PEE def Cubeperma (ny? Potamsre teks NN #9 {ip Return Statement a fanchoo te —acetarin Fhe reve, | ee aite apy Hae) : oF ashing: tne mobi Qepemenk 1 Uxecl_ at the end of HN isction. 7 - ‘ Tay usually inclicates the exit of he Function. The call jal be chansfemred to dhe tdhere it | eras exiginally heen called. Suterc OF Abe _nretunen Slatersenk metres ( rehurn value, wedurn value.) | £_ scuz (ste): st = Sic fol last = Sty J-v1 retunm First, last cowie to a function ‘ xeyz C time’) rip tte} blac Lo : nipe.-O_pytsan —Pangrenie sn calculate —arrea_ of using function. Make uec of Paramndier, Passing technique ! def deed circle (+) PE = O14 eeSulk = PL yer peokl" The Yesek af cincle 1", vesutt) CLEC CY iorcle (1m) - The cresutt of ciecle 314.0 | Joo means Century yeae. = i comryyy yeae cinded by loo is I sae “as ri Write a. python -Progrann -jo_desr “ae Jn is leap ox not. 2 I ase lees Cyece) ~ | if (ene ty ==0) and (yeas. #100120) 0 | Cheat % 400 220): I Prin} (year, " is a leap-vect" ) else: Padot (year, " ig not a \eap- eon" Cip__tean (9090) oma Pao leap weve. Leap (2014 | oi9_iS_not a _lenp yeas. Nosicible scope and Litetin 2 lo fF ol Prploin voeioble. lifetime with escape. “i Refes belo) code, edhak tu) he the oCutpup $ explain tk im detail def fucction) Crucobers): tote) = O Looe in numbers tojn}) + =% return tote} paink (funchonil( 2,2,3,0,7))). Scape of a yaslable i Aedbing bub the visibilb of that pasticulaé saosin! + T+ defines the gertoms thab cos" ACCeRS tbe — wosinble £ =the echons hab Cannot access Ib python Alto tppaxts concepts -aF local $ globe Nasiable. ‘* 1 By defaulk every saetatie declared he TE a_vosiable is dene cuithin a Lunchon scape —— Loc Lifedime of a vaefable is oleFines ag he tirne_ | feew eohich _vewinble _@sriste in _moy memory. _+ pineneves_function I's wed veretables “aime putin [he Poemncny. + Exacmple — det moyscape C) + _ HE becal veerable: A=10.90 AF Global vattabie- 1 ta et 0 table. a is ceutl oka! wv ‘ostraro. Ml) mt a | = — ¥ prog. ie a_pytbon Prag xam. foc me crecuresive f° Hunction. Pe |_ def factorial Cn) ~~ | af meeo, ‘ orehren dL | ele: vesulk = 9 # factorial (n-1) XPD Sto result paiot( factesial (9) o\p \20 NeFining function tlt adedrianal £. thése ance fous. adebitmal featuses sthey axes) Fellows: D Reguimed Pyauonent @ Defuulk Axaunoenis iii) Keseuscord Asglamenis @ voetabie Len guna 5 Exglosn the crequitrec| 4. defa k_avguments in gythe? A) Required Arguments ! : tT Required) anaiments ace Mandatesy cg uments Hthe function, mn These arse values pnts urbe _ahd_exder. during function eal). function « b Bolow i atypical syntat fox a sequined eagunet Exe-l| dof My! Funchon (ste, nur) paint Cshe) faint ( 3) Shree "Lucky" [ir nur: 10 [ ryreerer7 an My funchon (nur) | My-Fuseien missing 1 ene! Posttional GngUMeDST Hum Progearo , Explonaran I— coe have cteRioed @ function named My _ Fe feoith Awe Gt amen ts. b But cobile Celang Funchion we aee. Lone arguments. Lyhak means we are nob Rossing dhe reaqpicred nursbre Of aeguments. so dhe Fascton. jothés Causes even Henae is dhe olp. (i) Default Arqumenks ducing function Cath. Grd Mi +S werd : = 1 wunnen ke? fe a oes pena in—tvbich the value These age dhe arqurents Ave associated tmith the names. Hence -the positions of the anguments.” doe Nok matter. - I “Excanople: ss () dof py cunction. (name , Course)! punt (name: ", name.) poink C* counses " course) My Funehi U lp a Name : Archano. Kk Course! English ) dof. my. Funchiom Crome * course) int (“name", name) pains (" eouwrse:”, Course) fa). ‘5 Pa ety Function (coun: en Engl bh’. nome = "Archana ") Oy | fame: Acchans U unte . Enatish | al Pe, A 1 t Corinse. Hence even if ix sequen does nat affect dhe utpuc:. 2 : — Calling functions in_python, poe u. ing hep? Can_aften be used da make funcing cau more — explicit . E n classmate S oat Explain dheuseof variable length aegumen} vith Suitable = example, Natiable Lengits i qumenks. f st The veeiabled Lengib_cuegurmen dts _avety usefer] edhen }we_co_not_knac the exack nurpbex “of atgumenis _ that ill be passed +o a function. 4-“The special _syntar sags io function definitions in Python sie is “sed to ASS QQ veable number of axguments +o a funchions . = _'s used! do pass a non= keyword fasta le leas Ce nt list: o = ‘otare, def func (*+aes3 te te body of the Function HE wheee, func is dhe nume of the Functions and cae, holds veeiabl lenghe ong, uments. def My. Function (4 ange) : print Catgst) puint(" Call vith two arguments *) My Gunchonl 10,20). win a tacuricwon Vine lorink ("call cits dimee argaments') My Function Clo,20,.20) punt (* call with Fou uments") Pry. Function (10, 29,0, 40. Ip Call with two ang menk Io, 20) Cat with three arguments 10,20,30) [Col twith four aeguments 10,20,30, 40) __@ | What is Abe conceph_c documentabop_Stin __&| Documentation _shrvay usssmate, the clecumortstriag 15 joak Sunline ie comment Sicttennent + sca _is Vhe clocumentabon Tarpi ane lad Baas” docshings: These cee multiline siving used Jo exrplon the funchnn Syotee f_Ainctian nome ( poearneress): Rocuancat ashing evploininy the functos.”"" Funchoo Lbody aenen Lexpre scion] unlike cornment gtatersenk documeo takin Shiv, cremains present _dusing exrecuhign a Hence, we can acce Foe clocucnentabion Stir LAG paint sinkemen} . +t Emanaple = def cox. Fonction) “Thy ois fore addition This is dlocurnentadinn — Boing _evesittern Lore the tun nurbee ane read added.” \ finch, mint (my. Funch'no. doc) 7 pint" enke a" le “FARE we age cteceniny Qs int Ciopub C2) zi the decurseotaHoo Shiny pmink Cente D") fos Uspleging maby bz ink (inpurt\) 7 Farcien colts dhe oulpur C2 Gb pe rink ("Reset :" .¢) roy _-fanction() + Cau? the: function Fntee_q !0 en aet BD Resutt: 30 li) | Should cleclaxea using triple quales See i) Should begin — ews Capita) terree 4 end ¢ |-c_petiod.. peepee hit) The —-Garsk ine Should. be a_shox} descsipion in) TE there aee mere Ij lines. the documentation Siri dhe second line She wd be black visually the summa frorn dhe reat oF the | Aescuiption i ae O t Ta achieve the Create bility ic ange. F_ comple: progwacns rw have cto -fellon some Siandasd rules while. crciting Python rogram PThey abe as fellows _ By Thatead of using y_sonces inderintian, make use of —foue spaces. 4 make use of Oppropwiate. Coroment iA open porogran So yer thot the code tnecornec-rendahle & tinderstandable- I) Moke use of documentation Shing da explain Ebel functions tise) Byte Funchon name should he tube Her ix Lonustentte = seequired 3) The Class eamp OAS Be “aiicn aa Peg ——Hetes capita) ja block of the name, + Tatroducdo_h _par Q.1| Deine Pack a eee Luseé. _clefinenl —patkaye (4 roaéks) —___—__ Q.|| Explain et tng Re in brief (2 moebs) =} packages is Unethiag hutud dees theiome eaday meuthiple Files these file aan be pines Qi) files, c++ frost Along vith thes Alcs paciye oan contain number of Sub = package: 7 Peer create tusee dlefine package L we cull! Caeate a. fader Palivecteny Called package AJou_necuy. qe ony} name tn the package —cir_this is Uece adtinad packase. Lat package Should have init -py file. go 5 tohen ee i i Owe Si inite-py* Gil coi i S T fi : Fs . Qreps_ cto Cacente koge.s- fees LU in souk. cedoxking dive . sep 2: Thside Py flats aivectosy creale ait —py. file. gust create an efinty, fle. ~ Step 9: areas a foldee name Add fhside myfnaths. | Toside_ Add foldee. crreate File name. dklition.py | —The_addition.py tail! he @s folloc | | ff a : l__olok: dd fae Ca be | wP+ BN ath Beg: Rymillesdy the felclet sceb (ngiclee Pay lathe is _omenbed. aside _thich create file __} Subshmaeho. Py . def sub fun(a.b) yeux, autersabically 9 aqenesated discectorny {a=b) lep 5: The ave all_directercy barckive evil be as_qiven belgw- Mote thot pycache aang ~ Add eCL_pycache— B actbition. Pe | ~ sub AL pycache— A serbshection PY B_inik py T StePRi This dhivee. progeany os Aevding ctith maka {onponc P4yfaths. Ad: leccdltiac 7_bmpost Todile to un joopost Pty Mats 4 print (the addition af 20420 ic: *, PlyfMaths Add. rrespechve Functionality Addition add. Pan (10,20) | ” lit rhe. Lbeteachimn of 20 ¢ lo fs: fay Maths rb + Serbs 1 20,10) o1p Ht TJhe_additinn of Lo 2e 1's - 30 The subshachm of 20 4 J0 115 : Jo — usage of package ewer fy ea packege ' (1 z Rs 9e COD i i ot 3 £9. Pons eck ia diffeeent cx 4 Li)_tsing. —_— |i:)_asing “Prong "ks panel a i pt Lee = ex - im poe atm Tatroduthon to Modules - Befine maditle $ how cla 22 use modulet ii A module is a Al —thol Contains a python Code. the help of mode. use—deGned module tnith the help oF th yotheans impos Module name. S 1) Pate + dine Modul. -comite down a _pydhan progwan -to_paink Fllowny Q) Conevent cate ¢_dime __b) curewentypene, — _~ Cc) Month of yere C4 maers) date ime modwe provide Systera's current date sione in pacricerlae ferenat Progam. {oopenc} aleLbetinne X = dlatetime. datetime. now) C) paiok CR) ole 9.09% « 11-0; 10450400! 29.9626 )6 4 the date_is_prco. Jed ia The jimo is Sea ods heer Moet cana bos | minutes | seronds . micapseconda po \ also: define you have to cuca es yt ee ——_ 0 cei opeeation. SS —__b This -function_-seteens smallest et _vcwlue. greater that the numbee specified _in_aequrments Impact. mp. ceil C 1.57) op => |@ Eloat_opeeation : -T+ is_used dn cretien the flame 2¢ ces ap intyw =This function Tetubns intedval past of 15 which ist import math 0.8 mp mp. Flows Cs) ofp st) @) Log_opesatian = TH+ Is used +n retien 4th: lagostthro ef to to the given bose - This funchon ig used tn coleulare log of 9 ar dhe base. 2. impos paath as oop —_| IV) ModP opecation = ——#-Th_Is_used cho _eretisn the fraction integee ——L pasts of This fa? wretuens friction _f integee pact of co ——specified oumbes ra this care integee pach of f-ista cH poet of 1S Y's OS F Fay P. F " lomotch") we bove a math} ah = Yer! 1 classmate an 10. Strings Sead ch. Foca Shing shot Stee fs with Land end with man: ;_matthing of this peeticulas pattean we have used (CS) symbol ta indicate < o Ch) yonbol tn indicate end of the bsing Matplatlib & pyplot makploblib is a pydhon libxosy used Fer cxendion n hs. T+ _is_geneéally sto create 2D graph £ plots tay T Using _pydtenn. 4 myploilib hes a madule game _pyplae = vee): of. spoke 4 plots suchas _bistnqnana, oat charts ertoe Choek ete 4 import matplotlib. pyplot as pik 21,2, 9,45, 6) = [51,2.,354,5)61 en (oy) ears Plt. Shou () Show He graph olp Nomp m4 18 -AN_acaen m_fer_Numesical pyre 2 mmhich is used - fox - ocessing— SY eae _Provides—opesodigns—on—mubbidimensisna) grip —}ateng—taitla—some—lnigh peaferrmance Asal’ and J Et |_prracess| no e, | featuves + —_) = — N= dimensianal Obecy, object | i b Proactcasting funthans. 4 F Vasious stools ere integrating Cl ct 4 fenbwan Code #Numbes af useful linens | npalollity. Ore. | i © inypent—Aummpy oan & $= npariay to 12,9.85 e711) paint ( Aavay phot) | a Olp a Avtvouy: 012,34, 5,67) & =) pene Numpy cl np x t2np.a e (Co, 10) A gaint (The datay iss’) a paint ( he Oe a olp i ye ontay i cla q] t The ty i Class“ purapy- ndatintt + above code siBet is 0 Bonich is inclusive. « rap is lo whic is exclusive . Hence tHe, ober} coil) be Th rape oP. ane. i classmate. isto make. _the sense ont of data cove need tools— ff. liowanies. 4 pandas [spyder Liloncty eolich is usec) Ferr “ a eS purpose + Tp Pan: as data can be qemresented in 9 warps ‘ Cai Gg == Tt is one _ctimensional array. Vike Stucke defined in Pandcts impact panda, A8_pel L dafasTit,21, 31,4). 51 61, peasy l df = pd. Series (cletn) paint (‘The sees is:\n' of) print The type i bye (olf) ) The _seeies | ve on 31 aI si 61 a 7 3 livpe : Floctt 64 —— oO} DIAS Jo] »| —_ —_ cxeovion af _ seat: using dickimnaoy. -_ [= Qichemaey ating but she Key. ~ LF eohen me use ditticnoty fess_crreation of eo | ii) — impor’ pancloa ces poli as ee eee dis Datett, ‘b's 313 da: ia-=si,'b=61 : dates 3! cola ' 1 cht 208i whatl_is__Sbing _ ist be _f sting (s da gequence of characters whore _| the Charractene canbe alphabets , digits , space __lax_speci jal_gyrbo bs Crectting Shring. L shings is at inpostant type io + : | = Wwe Me decane a pian Cag uly thes ingle quote or double quebe - Space, canned ,2veeu bing insicle those quotes mil) he a_Charractes The _sbsing_is _Jmmmudable data Shuctarce. f tromutatic means unchangeable, mean rthat can mot pendhange: Te python Shings ace jottoubable sequences iihich meang dhat they caolk change. il python doesn't have Yhe cha daha bye like C++ fava Alors faq| oe prograce de declare the Stsing ns “Thig 1S python programming" . a H Fay J J 7 fo Shrz "Thi 16° Puthon Sing! | git C’eksiag, declared eit Lisgie qivoh str) (Je can not use a single quale —in_hegia_O- Sting — | 4 double quote +o nd if ££ vice-Vessa. | sms this is code" C we can't crite tke thal) Qh ' This 19 “putbon" oy Meats 1 chascrute q | ez 0) jenn) oeannl A creccina = al pe can_acceas each _| individual _c harceacters of a_sksi Using fades - Re Each Shatlaos Yan be Occessed in Ogu [Svoom dhe front From ts ear end ; % Backspace \c. _ Control - x Cmx Cantro\ = 2 Escape i £ forenfeec! M=\c ose Meta - Conte) = 2 = Newline __ AOD, Octal Notation etage on" % Caren sre bursa, i foo P. Ar Tab wv. vettical tab 7 Chaccacters pn, Hexadecirnal notetion , bore Nis in the range 0-9 AF ovAd Na nn Desceriptian. Contmatencitien wou | sto gaia th baing Repetition Cancatenate multiple copie? of Sti. zh Perhcularn shring- : a [:J___Range slice Tt helps 4a access the chataclere from the specified Stoing. 10 Membership tr relums _mbhethers_a_spetifiect mH, us reader [not in _Membeaship t+ i's also Called as Membership operate: fee pepe ties ite of in Th vehian. tae if a specified Subsising isnot pissea jo the elaine) Shang & Pheonie rnfeTeth FF cheonie pheomin pheon's * Sha mebio sht does the exact oppasite of in: pocesent in the origina) Stsing. Qhsing ae. 2 foemudtnhle a! 5 teh * Qhsi are immutable” Are or false trive rewsen, ane _imperrtan} thing hich makes Shing diffesent (03 t weal individual chernctexs in che sbing Tt is _4 copting to use he (Iapersertos om the left i i i fon Chana a_charracter in a String: ~ Fox “evaranle wy yosq_= “Hello” msqlol= ‘8! - 4 evror fais (ross) teed E et ake Ane Stuinhine aaianere f m: a " Hello” ——8 [Steg accent ayn Ns how +0 Use % ‘Sy jbl ny ioe ieee aap SPE Se cpmided by python — ate type 020 a fe nae —_ — - -_ — @) builtin Shing methods « | | isk ercplai. i panes : ery _Paouides |_PRletnods te _pesscfencem ___ rent _apesscitiang ans 5 8 . yan ofp ¢eHATF aR + st India apg te spat te EE @) endesitt Cvalue stoxt, end.) i - This_methad vee tue if the _sting—ende cin” Example = bs= * Thilo dhe best Caunbry io dhe calgy olp TTaue @) God) = Tt cretuerms the inclec of feat occurance of _ ubstsing- Excamel Shce*T scerearm tou gcmearm, we all scdrecim. fox ice -cectans! print (stefiod (“ scorenen")) o)p f Q. ; i ®\ index () vere 3 al searches the tring fn_sperified salue ety dt 2. Pos iho of Coherre T+ = crc found Dow." Print (ste indes(" latex") o|p jo (7) Lisatpla (> Lp votes due if alt dhe Characters in 4 ing are alphabets ; eee ‘India’ print EstrvisalpheO) + lp — Thue are. < decid to- Ef “ay" px tC. isdecimmal()) te “Qbl23us" Pain Ce isdlecirnal ()) olp " Teue 2, Ts cigit Tt Gots txue if all the chovactexe in the Skin fc pe eae at Eq- eau print (S. isdecional () tz" Hello 1294" pxint(t. isclecimnal_C)) T ole Tae False. igloewee.C) i ruppee( > 5 = 1 I. ed of the bing are iP lowercase = isupper() reduxns drue if all the Characters — of dhe Sting axe in uppex cace 24 india _is_o great’ = "INDIA 1s’ CREAT" print (4. islounee?)) n punto upper) r='JT Love ro: Court” de "T. Lave ual print (S- Ys oO) print (S.is upleed Ole op Tue Trae False False. @)|Len) — Lott nredtinns Jer chercacte¢ss in _be_S Eq- s>'T Jove oy hey paint (fencs)) 0 rnd) -O\P | @® isspace.() Tr nets hue if all tbe characters af the ot a oes a ai Icing axe. in _upperca Cu Eq 2"\b " o~ as pace ¢)) “J_love my Counbe' one (E. iseypplbree 2) ole qecue False. @) sceplaceC) toe (Fi. ae pe. She> 'T Love my. Counbey paint Csr. ‘vepl aces iat. op : cr Lov coy Toelia lowes C),-uppea) to towlestase. —uppeé() Comvee}s all Chasactee inion the srs] Uppeecace a pecifed phyase —t [ rloweel) ConveePs cits ehaeacter fnto the Shing | Ses Ms PLY. COUNRY" i_nve’ ter counts pat [print Ast. loweeO) —_prink(siuppexcy ___-o]p__ O|P. i tove- My —cotrnbey TLeve my _counTRY @ltetip Oo : Creer} PES gh = Enedva point Ech dip C) +" iso cotunhy) op Trdg, js mia mae , (ie) asdeip C) esse etait ng—e viespaces — of the Crring Cf leide.) [Ee he = paiat ( ore ons ig a. Coup key + op sant 2 U Tndiq 1's GQ Coun by 9 1D Rebun highest alphabetical ehnrante TT eminc) erefen lawese allo bey alt obeeacte bell Qhr = 'Zebrncacnseiig! bee | Reber Cressing’ paint Conase (sir JY - print (min (sh)? O\p o\p 5 Of Ge) | te | Retina freer leftee of the» bingy do“ uppercase — thon —20sy cho leqary! —____———. Pyttom TS Fesy To Leoen. (9), plitt) “This Rinchion splits the fing at specifi 1G acehuens ain list Ex. Str = “py th oste J it easy tf to leatn’ prot [ She. split ('#")) |p f Upsthan' ‘is', ‘easy’ to! paint (She. fill Us)) alg . : ~ Le OO. OOO0000 python 8) String Operations q | Strida slice is an extmcted chuck of ¢bacscicter ~ Moon the Arigna) string Exe msqe"' Gead Mersning" et J mag Co: 4] Olp -GOod_+ Fe. még f[s12) “Paesning, Heve the atsing fromm oto less thao 4 index “ete inde coil) he displayed. Th the next Coromeand +he skiing Po SJ toil indese is di etiegee Jo TEE msg fora) ™sq L512] + classmate. Date 2 Pose lord anel_chrO)funchon._ [oe Explain fellocwing_metbodt_i)_cprd ji) ehx python ado £ che 0 ore builkein fuoctons. they avre._used do convert a chamactee ta a0 in ram [& Nice vee. f python excl) hel) funchians Gee exactly 4) Puthon oxc| C) ou python ord (\ function takes String oxguenent ofa ingle _unicade cheeactenr_§ ‘retuen_itsinbeges unicede cade paint valu Boce Ch = ad ('k') \ HTS. print (ch) paiat Cord CA'D) HES fniot (orl (x!) 8B paint Corel ('4')) + 36 i)! python chy CO) Py; 3 ethe chet) method aetna chanactes Ca string) _ sep o the clrarnctee). a_characiee Ca fring) mbhese Unicacde cade point 1 s_ the jotegee | 7 Oo Lik he Integes ia_oussile the anoge, Nalue tyne eoill be ised. Fx print (chx (6s) t B paint (chv(97)) tke prink( che (1428) Tr_and__not in _( Opeeatoxs. Shing. sith (O* : Q Ealain the —use of _in_§_nok in pecs ie Lt These opeeates are used 4 Th $ notin ave Called 01 reemnbeeship : pena? Fhe ; bing _is_Q membex of another Shing as mob. The. membeeghip apeentis:_cam be” implements witb Shings let, tuples ete. Eee fo 9 -T£ the opeéeend iS_I0 Hye Given carer huceve it weduens dre oO false Dot in ‘ TF the opecand is ‘nat’ in the given clate Shruchoye it veterens due ~otheeu [eo -false. as , gh =" Hello” if ('e!' 10 Shr): t ‘print (" ‘e' is pre: ent Ip: +4 © bing”) else: Paint ( os Oot frre: ent LD sth ¢ bane“ ap ; on te! presi ent ip the hing @)_# | Composing shings ‘ : Well anite ot puthiin progcam do cempase dian Shi. fom _usee. a input € 4 moeke). (we CAD U2 Felational_ax Coraparison apecdst (7.4.42 <3 -c5, 12) an [Pe _python. Shsiegs axe. a in te a ed an a Ct of cthe_chawnictec J ‘ 0 - String, - botb AS¢emr va lues axe Same_ Comparison of mexk character of both _ 18_done_£ soon.rf ASC value of i dtheo Fak Strings_cheractee, is _¢ weeatce - thon Shpg’ is-greates, dan Shing 2, else vice veesa. -If_AScID values, of “all chavaclees in both are samme then bath Shing ome equal. a pate “yi ) — Falee “ Adthaev D) => ree paint" Hello" print CY Athatva 4 Vet Shing tHiess r : 7 aa yy \ 00 ZARA Fale Ses iesinen Orin (* Athorsva" < pik.” Yeast, Tue L* ednt (“right p= “lePt") > Frue. : Riese are _atp Tie, Perea Ne Waa des Whe Teh vawe is trac. Titervating Ching lEcplaio aliffeeént say to jleeabe Jning_evith 24 = Shings ave in_Sequenite dupe ¢ are it@rable = (ue Cam ciccess Stsing charractee tising_lo, p—_Skont abs” ‘i Slee saga Osaieate: a painkCi) pees A\ re ake Shing ty a r rvrongeC) Frinton “aenoedtes fho numbeovs in seg ‘as pe’ ray ecihiesl as cnrgugnenl othe xa incltan oF *P of anna ea fe ' ie ts aize of String? + we can 4 : h i thi: eguence — OO pevrabe Shshng Luairg numbers itt) Thervate a poathon of Steing Le can use Licing pee ncters to ite vate cL POkon of Shing. ce cam Say a Sub Shsieig, T 1 we need in fovicle 9 parameier to the Nite” operrotere ON se att | tepees Shing I Stas} ! Stops Step size] + Sheek hich indi sae the pararneted, te) i sthak from there itevahon of ting should Sheet. ‘ = Stop specifies when ta slap itevating Shrine Step. indicate jo which + s iterate. Ee = Fo: 4:2.) sat op M : = \ fret ’ p £9 sing, euill be thexate Sy _akipring © Chasackee 00h dinne: Str=, Pyibon | ax feel for |i in che Lo:3:) 2 oxint (i) Olp ‘ J £ a fox iin otn (2: OJ: heeds Paiot (i) olp-—e HE o Sperm Shae a Prank OD e h § —_(@) th Module: n Qi wlad t_noke_on the shing module (41k __ The Shing__module Nrovides pre ~ initialized Shing constant of voeiaus types : IN new veesion of Python , these unchon are added as built in function 4 isalpha C) stable Frame bet 1 jornent 8 __Shring _ Ther AS 0 a. i i oO * Shs One ipomeutable"? OU Hon) de cancatendate 400 cbngey 5 QS} Explain slice g a s tei Q4 | How da format shite, e J S|) Explain siatioud coy Of —ihewaking ex _staing , @.6| What is) king me we? @.1 Explain orl © 4 Chet) function of Shriag Qq Ski ise relay. @10_Beplaio any Foue in built functions of Shing

You might also like