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

Python Unit-1

Python b tech unit one It contain first unit notes

Uploaded by

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

Python Unit-1

Python b tech unit one It contain first unit notes

Uploaded by

Akash
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 17
Ht Memboship epouaiersi Gn and not inarse. tho. amombor Ship potters Inhythen They axe Usod to Ho. te¢-Bhethen a valhe or varioble Sa found $n a, 909 wence - Cshaing- List, duple, Sed “oval oli Ctiomey): Tn_a—liction ay ote” Coh only: fost fer Presence. of Key, Nok He Aolle . —__lopertacha-_| M1 eat a Tp. Tawe if. Valle, — ey airhele ig found ints. “5 tn xX ia SeGUence: | 1 — are i | | promi [Neuing | Jeno fn __| Tere. itevalue/ceariobse fs mot-fourd Pantie | * Tous, Pag Sop Wonce, : Jot. I Foun, — te Exom ples: Membor0hip 6pona pars 2A felt Python. _| Pe J Here. = "Helle Lela” 4 ‘yt is @n_% but “Follo' ig ont prelont Y= fatal oby = In_a._Co-ematol, Psthan is ase Cehsitive | n Similasty £58 Koy ond ‘a! 0 tea qalue RE @utpuk: Touo, in dic Himosy s Point (Ht tint) > _| —Hence. 2 Bove it | ta’ Sng yetusins falc Luc plo 2: He24 § Vo 220 ‘ ist 27°70, 20,90, 40,50] Se PS OLY I Falle. —bell hello! not tins in) ten lth otarpuki Tod doy ner ae : (. mot_in List ): Ae nor present 19 FD) fie Output false ta a one [ais Present In_ List”) | paint Ca! fn ma y in_given Lv] apn fap‘ tha fi Jetwins a. file object Called ts handle ond fH is ded cdo Seed Or emo fy4-~ the. file. gis erent: Sn given List | fi je obfect sopen Cle. rome) pons rac _sh= open Cent bok”) “2 * iP tye file 39 pee lifer diveclary 2 sfeopon C*C:7 uses potion [path tot) Ob Fea i v : filo Giest 8 te rel | dotect fats ce “Pil. 1 Wwe _Meed to open the | ils ~n esaite and = open (Mesh tape") | iat (#-crecd ¢)) import OS Bore #7 = ofen ("e-« Fark" 07) | fos emma CH Tae eee "Hello « Patthon \n") t bite ("Hello Jor") Now i Duet! the. tests Peocts: : ite we can See ts content as. [HellocPYthen, | Heto- eSeer/d = a_i TT Gieue_bomekess can be tided to i { access olomentS of tus, Hoing | A fnt- (" Crnpeten Science. pote”) Tt = eA ouetpap He Ace essing. chavacted in pythan Alaina 2 PYthdin Tndividual chanachou of a Asi. Can be aceesied by wing, te method ong: SrderPra glows megative adbeid Nefenences to a cce’s Chanact ors from tos back of. fas String. ELL [LJo]h Tole 2345 6 FF ng. 1 =" Hello Kemnalika, C*Sniticl soing 2") faint (Stoing. 1) atin C\n Piast chastacion of Spiny i! | Pant C3ting. 4 071) akienakalled | ————— 42 tue Can. alse SEV IO _& B4oing bs lg, angi =“ Hello Hoang! ong = Join Coyee ented Cangi)) pant oa) Blt pth B= fl akilomakolleH | [ae el es be wed i J oot eon OF is He ordered coliection f cht ea ; r F & Li Rel L f ~ o Create 2. ih wth emultiale, ehaz hit LL i on fole] r Es _ Paine CLI) SoPythen is @ collection of ordered E 3 bear ond mutable, elements. It can hald Li * Create a mulh—p List i— elements of. differnt data types a. ie = fom e301] Such or Integers . Moing? or even — Paint (List) ip fn __tthen Lists. u s io _¥ dist Srdexing 2 7% Nur apt — dit = [Peja "7 047, £7] lesi€d : Ligte maintaln the omer -~ ‘i Point Cost 1 List (49) ich_ome bee oo it Se a 's' Wait Python 2009-c-am Calculate Fhe Sum fall Integer f _a. list Pomided by Tha bse: [® Tnitislize an empty dist fo Store Wen input TnkeeN] tt Point The Bum ef Iniegzout- Point C'sum of- fntegors Tn the Lish:”, total. Sun begerLsi=LI Ree = Get te mo. of elements in the Mist fr et called ' IK, 4 Hf cee 7 ste tina bey cf Pnberzou thoy tort | 2 nt Cin pe-( Enter the mo integers | to fopGh 7+ to a Loop to Colle ct thos: ed . the vist") | _Sintegorus, C ectes theio 3 d pee ee _disphouys fhe 2e gulf > __ aig tbe nai ee Re Set [A tep i g, [B Set isan tomer r \ im + -bordered, 9, | collection of. Unique | of. eloments. Collection vf. elepents. | elements Sinai, | gnc orlader Supa} Sond way Syston Tacs cy racket: with 9 _| uta ? [brackets $4 with 9 | le (ET cepaiated. “data sepoet det | al Sepanated dada. ted Key value dete. fenton Adit con | be PEN coon_be! mevisd A cot dickimaty Can| A dickarauy can be [be created using | es@oted using dine. cn Simple, assignient | im. Ave get) tunetion | dict O sun ction | to Ey. _ i I ea , a pnnety Dota | Ain empty. Jiet con oof Anvempty tuple An empty get can | An empty dictionary —Stoucdure. | be Created by Can be creat be Created by | con be Coreoted b= fy by t=() Oador. J} Gt isan omdeied. - Gis alo anordend| Tt is an unordened | ordowd collection in Wa! | Colteetion of data. +} collection of! data’ collection g data python cversion:s: Ci weil t rlitodn 9. FF 1a lunsrdened fn python clersion = 8-6+ | =| pasomete rs Set » Dictionesuy 4 | —puglicaPe data ‘Beplicate __| Core ae lL elements | Keys oe Unigue, bit [ Daten entry is alloesed |; wu Unique. (4.00 disper Koy CAN ii Pn Lit. [en a set- howe, the Same Value iT Gndeaing 8 Pnteqer based oes NOT haus | Has a Hey based. U [Png Lenfing- tect. on Inder based lindexing ie Keys ent? Sdoorts rn “0 2 | mech aniorm. identify. Hrs, qelus . add Rion. New ttems Can be Tha add Method | upolade() Method Hw | added uly tot | de adds an clement a TS at foppendh Metre ‘toa, Sef- —_ Debetion | Port) Method _ 4 | Elem ongy Con = Mors deleting. be. 24ethd amy = an/element | popped/ddeted. [deleted yi = Booting | Sort Method PYromubohh o Sorting. | Un ordered: so Soxting ig—Keys ace Jordad by) ir ~ Soct3 thre. elemens| method. isa weplicable.| is meted vised - uting as Surtett) Petind- —__ Count | Cpuntt) emethod | | Comsat) me Cotut () mot Sr seitner defined ~ sjetWurt OcCwoen) so tors * abe defined ‘for vor dichonanies, 5 —|=ce Court - _C Out | — Sets ~ osha [Eaimealcaistt ntclenia esimatean eee bet lent et Type get ibe anal ee 42. D8 A sek is 0c ci ‘s_ both | tamcore. ee 1 Se of appl a Sets ast. 1 oe on rr Cusdlly --borackets Lee = | Brompde orrearte a Set] ~ ‘ Point C Set-L) Aiisyop = a “chery || Potnt- C Set 29 £9 Pott Cthi ever) | Paint Cer 3) on tera Ct | Plana ale! pang athe deogha BEE 2 To defo, How many fleas, oe Set has, Use The ‘ben () anett,o ¢- oF “Plodel!!: “Mustang ae CORP EYE, Lacie i L Dy climarieg wu tucd to Store aya) avalues jn Hey : value, Po'ans. pF Byctionewuy ftems a5. oy-dO led, ch 5 Ugo. ar | Ly Dictionary. TLems _ | =ble on dees mot allow duplicates. 2 Dictinasy Ftems axe. presented ‘e. A dictimasy ig a callocn Su'on uss pork 05/10/96! is @rdend* ch o onddoy 7 | au lae/atas, — mot atloe deplcates | Python dentpes ; 4 As fg python veosin ct ,dict’marig | + au. o-dexed In Python 3.6.ond | + Files G. felersifors Savrilien , diction gxier_ane unordond.| 4s Should bE alphabetical (uppoy £ Jowe fee ie Example ![C swate and es LG ith contg | ond tT | ; b@ Contoin digits Cote 9) — ly Special 3ymbol_C) Ly not be Skarted eran digit 1b casie Senstiv sbhisdict= Fy _ "boand": “Powrd _ “model: “Mustang | wyea: 19643 point (thi sdret) \ eT ic ’ : ute = = —— ee tl Beale etenbont io_apoider To Sa 2 Define fords clmetniice— and cioit-e a padperem UH Ale eee Alig eh Liat isa. Collection ef. Aobiteresuy — i, ag fo Somewhot aftin to on 4 Ht. Deine. o- bik la cay ether Pro eee J dowits = Dart onl banana! orange’ ee Toons pune es ongre flexi aah Tenia a ican Poon be = : __. enclosing. 0 camma«separted __ rf gence pjects fn quate borackets 0s Lhow pn belo: se ae hae? baz” Spe] Pe rere ina - too! “see an “g ux") iat en, the. Guemberilyp ofopdes “aa. Impertart_¢ ectey' ios Aff. nd net In) ose Used to _ sli ee fee etl hep a2 geal. 07 _ Aists dered) atte yal Ina a Seguene amet ie can Cmtain any asibitre: (eels. _ ist, duple _b, List elements con be accessed By Inder. Tekemieho Od —} Lists can. be amerted 0 arbi itso clepty — i— uu . = _& con: tupdsiand fet. "4. A/hts de_ gate omecan joy. ppthan felentifin 7 I co Eh Python, an fderti fier ja. mame 5 oAet _ | teple sed to identify o- sou'able. function, ; | tos, tek tbe ctr any ctnar object _ ahr Se 7 udoble. | Tuplet6 Temutash 24: foltews Certain ules, i are _ li Mant vith «Letter Wie pamdoned | isdolered ~~ s _it 2) 0m an tid erscore (_), collection of [collection ef __"_foltociod by. fettoss .undeicers al items wr digtts Co-g)+ thon identi flats axe coe = Sensitive, —eme@aring, Thy vam’ ond "my yor" byould | our Stems ae + Thems in Yet + ‘Ttems In _ comnot be Chonse | tuple.connet be treated as abifpetent¢ Tdent fou, d wo yeptaced “| be, bonged yout Sian —| or nenlabed 5. Moite shsrt mote an Tadertadion ord 2 _ difetionely mew Stems = — “gt Indenttotiem it La, very, tenpowtant Cancer ToL python te cause “eotthoud- Perapex ____Inclerctieng. the python code, paen< os ° yet wail end up Seeing, —____ ee Tndentection Earner _ond the code ill mop get compiled - ___. ~ a a —_ ttle cotzonasiy is a. Kind of ita Sher crust” thot Stoner ftems jp vl tanya yd ~p, A. bP A _bnigue: fdertiHen yor un tem And: a. goalie (9 Wa olofte AAsocl ates valth siti Key | Dict onasnics n_Store NL Srmadiey _ but tluoy. Can be Used fats omu oh An Lo tae eS —

You might also like