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

Module 2 Part 1

AI related modules & Questions
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
12 views

Module 2 Part 1

AI related modules & Questions
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 13
uytdon Py thor To waite we use PE Command PdomP+ XK s>> ¥ >>> Painale Helio”) \>>> hello aprsieds Ki is Vadiable name, Tancil ¥Kures can noi use Keyword ag idenitieds DN should Not conrad whrie sPace Thesgade Case sensitive > laensiified name musi siadd withal althale! od at undedscode only lt Cannot Stati with adign Dararytes Yoasi < Ayres | inafloat, comPles, bool, SisPg Dconrained tyfes Lis} AuPle,dic, set ‘Dosen defined Ayhes Class D> ryte of 0) X15 a function ro dereimine whieh daroyfe have | jaensi fied on page: ec ern Benny bgnes (O= 35 “>> >eaing (tate of) >>>in . MultiPle Vadiable Assignment =o P= 9-14) N=\abc’ OP =10,$:14,'abc’ A=f=N=b Adithtne tic ofedatons aes oro +,%,-,1,%lo, I] Wlood dinision ofe daiwa), Xx L eExctonential Ofedatod Aollg = AXXb~ a” i yn Precedence and associativity Nod) ¥ Pdecedence is stich oPedatod Is will execute rst XK Pdecedence ondedsSrhiqhed Pdecedence +o lowed Preclence > LY, X¥ [Aight Steet ascociativitg),-% ~ | =I] ~ alo (WersHitht i et ‘ rE | acsoctativid) , + - ~ (ers B diaht associativin) : 3 ; . iviay dale fad Yi game Precedences in ah ofedaiian will obey associat” N Tyee convedsion. (a= OH a= % Pains LA) = 9:14 Fdint@d= N43 (D~ intLD=9 mr8 y FjoatlD=9'0 Tunciions in conversions: IMF Ly, Mo atl, comer OQ) bool) a=9-14 Paint (@~O-l4 Painalinsd) => PAinalbooltA=l Built-in functions ab Six) Dabsoluie Value of a Powlx,)> Powtd of L ot tnin (ety cca, > minum Nalue ey > Mascimum Valee iv rod (2.9) > Paid => xis * oo) . — - ; d : Tdound (x, fr) 2>% dounded, 40 Mf ass atte binlD-—Sbinady value eguivalend) of T - pies PCALD-> ocral value equivalent of hex@ hexadecimal voue equivalent of * Huili~in modules | KM For mathematical funciions( oredatisos) Ymacth (using imeodd) . >Pi,e-Value of consiants Fie >SdaiHl)— Sfucte doo} of D Pacrodi allQ-factotiad of) TS Laos (cd) “absolute Value of float % P logt-Q-narual Ipg of 1092048 the base © me Plog lD- Madurai logos xv, legrde the base 6 Sx plz) -exfonent of x, e% | DSAdunc (sQ) = aduncate to insedes >CEMD -counded to smallest imeged > Fhod Q~reundedto laigest imreged PMedf0) factional arck ieged fast of ~ Orn Coniained dortaryres oo Vig the Collectio of data irems (arues AS Drisi : | ¥ Rey wioda ts List j | Xelemonis ewe Hefdesenied in squade baackersy y KW AHIS any elements can ingedted’ — -KMistd datatyfes a in the tis} initiated by, Lish 1ST V.46,"ane] RemPly Wet, LISM= PY K Collection of ddeded: ements X muravie laetlacariewe can chansé) Wire co blewmae wij.) - 1 ioe XSet Kedwodd tc used Xlemenis ade defdesentedin cudiy bdacesk 4 XK iMitvaigen, emPiy sei, seit =sao Kunoddeded cotlection XMutarie Kho teaate 4 % Ueane cde tonto elemenis(no defeated elements) NTurre XTuPe Keywodd is used ye Xelemenys ade dePdesented 19 0 Xn Anis any elements can insedted Kmixed doraiytes ade imahe is Kemer lisd is initiated b4, yuPlel =O Koddeded Colle ction K immutable X Vredable ) pica KOIcd Keyword is used fod dicttonady Xp is the collection of Key Value aids Kunoddeded collection Marae XK No itedate 4 KDA =f name’: anw’s ‘age’: ¢} Died a fame = anu DSSingye ine command St mult Vine commaMd Sr 717 og WW YY _ D> siorementa | _ SHatement4saiement2 Statement 2 yA ewe 7 ay Q waive a Pdogdam 40 ened a No rn! and) PAM 8 ig ‘A ie yy Paint no ipa is -ve Ans C=inilineus Henred anvmnbsAr) \f n>o. Print nxn e\se Paing AxOxKN ss while Aw\ Winile condi Aron: Awhile condition, we Stade ments : SyatementS aioe SiaremeMts fod >for a Wo Vist, 3}. Sod a WN US Slade MeN ts Siahe memMs els e Giotements DP ranger Sgenedare a SeQueNnce oF inregeds Mange (10) >> eacecure fdom 0-4 At Mange Ataay execute 10-1 jor a dange Cle, £5,355 10 \2 14 6 19 >for i in dange (toro, 9), Paing ix} OVATUA SD \ORVO/VIXVD/AMAIM, [6 X16, 4 X14 SD Wdeok and consinue Gading ae ‘ Shae Pdesettarion> A= immutable > No elements S=\Wello’ 4 Sal ate’ Deddod mn S'Bye’ a Pe we an chonge Bre Value of $0 WE CaN Mor change dh, Clemens in a siding: |b Do yding concarenaton S=‘Wetlo’ Yo'wodld’ 1 Fading S4Y SHellowodia XK) % D> times to distlay [fear 5 = Netto! | Painy 5X2 jouttud > Vello Hello #)Paing Ua’) OUdKuUd > AQAA0 | | Kin Syo check one siaingleumetaicg|chadacted! 1S the Fass ef aniorthed Siding, q 7 Pains Le’ in welld) Oudfud D> taue (pigar a Clement Siding ch Qoei asin: false tee > f 1 SAding sheing: j pind AW is to cheats a Swosrding, Aram a large siding DF A='fello Wodld’ 01815) —Heto ATs1ad4: endl - Hello Wod) Afsiaadlgeowoedla Be 3h. Hip, Nor in >To check one SAMIN§ is Noy Padi EX Pina batec’ nos in ‘Hello? Oud PUA STaue Of anoihed Siding Functions in SATIN gs KEN S length of siaing x MINDS chadacted with minimum Vaiue MN Heo’) =e Max) Schadacken with maximum Value Max Welle’) -0 KiSalthaWscheck ig Ql Ehanacteds in a Siding ane alPhabess &9: isalPhathelo 2) ~ false Kisdi¥iry senecy THAN chadacteds in a sading ade digits E91 aigis Las) —4aue tsalthalneioi)=false F Wsalnuy > check if all chadacieds ade alPhabets on numbers £9 isalnum (4 hello) = false % issloweaW STo check all leieds ad@ lowed case 24s toslowed (Helio) = false Isslowed (shetto)) = Adue K lourreddSTo check all lerreds ade utfed case C4; Tourfed WHettod) =falce VsurPed UWELLO’) =14 ue X stais with) STo checra siding siads with a value ~ A= Rellowodlda Sadie witht) = false Brads witht) =tdue 4 ith 0 Value lends WAH To check a sading ends! e4:a=Hello ends with (8) = false endgwith 0G =Adue Find Sseanches aValue and wilt [8 $ dePlace one Value with an othe ten iis Positton [eda Welto? Netlace lv) O=\Wetto’ HK IYoin SJoinis syaing into each ekemensd of siding one | VarceAy last Glia I eg: fain LY”. join ( Hello% oat outfud > W-e8-\-1-0 K Urea > conveds inio utfed case €4: a helo & ubPedd) OusPut > HELLO ¥ lowed cy S convent indo towed 645° €4: a =NELLO & fowed) ourtus >hello ¥ cafijali ze Pings chadacter is coWedted inyo urhedcase £4: a= hello acafita\izel) Ourfud > Wello AAANED Dconveds I characten. of eachwoddinte ule" ia Wiser eB. a= Weg world le AAiNELy Out Pure Hello World X Swlakcas els > (powedied towed case to UPRed Code and UPted Case io loweNncace PY a= HELIO WoRLA OA -SwaPcaset’) Oulfus> WelLo Worl0 KSANIPO STo nemove white shares {Hot the begining to the end a=" Hello” A-SiAiec) OUMPUAS * Melo! KSMA D To sPhit a siding inte Sule Sidings CY A=" Hello wortta’ PaindLa sehial™ >) OUIFUAD" Wello”, wwodla” SAding¢ ComPandisol: a ey ok XTo comPade she Sidings We USC L,>, 4-79 =, = Na [List AH Vendy renath of Ns HARe yD Pe 7 ” 29: ReGed = [rarrie " Vodange", "qaare™| Age (a) Out Put > class ‘list’> Functions used to insedd: ¥ ingens > inseda elements to Indes 24: a= Partie",“odangel | actnsens 1," anate?) 1 7 outful > als apbie”,"aaare’"0norae"l 7% af tend >To add Of Hern Aoi sne €% fo BFF “§aafer nw 7 2 a Fen RUSSO Cone quae | a of ahe list ca Bi iNto anodhed a Keen >To add a \ist of element ilo ; be RV ae Pageler,” odangey b=[P dea”, Yellow") aexiendlQ vw de," yellow? ears > Tnahhier, pois Kidemeve ra STo demove astecified We C4 a=[Nae rie”, VodangeM A derove [Hodang ery Ousfud > az[roerietl X Por >To demmove an eremert fdom 4 > ZIJia. oe) : Ourtul>a.=frarelell IP dou aon't she city index ,!As4 qume ¥ dev same function of PoeLd €Y. del afsy OudP ud >ax[odange”) IF you aonlt Stecifiy inde, the Net 1S fully! demoved yor DVictionady Or\ oe ¥ Cad =f" odand! wad ushi?, ‘model’; 'masiang’, ‘Yead’ + "2009? fet Kiusedto Stone data in Key colwnnng jues Koddeded tre % Clements ade intered; boolean sAaing Nis of cements K€: Veolon’ [rdea!, Weluer XK do not allow dutlicates | pon pacified der 4 will demoved 31990 i * Vo change the value of LGRHA Stites is, Canfyeady = 209% Functions in dictionad 4 Kien >D length of dictionady Krvrey > Ayre of dicionady CI Anke ead 8 NP > Kcrasg talev> ACcessiNg elements fom a dictionary’ ACCESSINT elements or < ae Dae C4. cad-Qed (“baand” olf >madushi 3) Wegsea ea lisy of Keds SS cod neysl) X= cad Keys lf >a = Brodana’,® modet”," yeaa” YNatuesey p4et list of values CY. = cadNaluest) PSX = Tommadurhi”, *tastang”," 26007 idermey ger isa of ReyNalue Paid C4. 8¢ ca dtiemsly olf 2% ~[pdana’ Madurhi), C moael’ change vaiues fdom dictionary: Dea:cadpryead’S ="200H" J uhdsey lea: cad-utdatelfYead’s! aeou'l) Ada i1eMS yo dictionady: ea pan ficniea a! nea? 2 3 rpastangy), {seas a

You might also like