You are on page 1of 10
Ryton _[dntrodoction] -_ | ists (2) Hno many type of built-in type of sequences In Py then? 2 Python hos ssix_huilt-in types_of sequences 63) Write thx: output of thy following = list 4 = 0 physics) ‘chemistry’, 1997 , 2000}; rE Vist 2 = [1213 S, 6-4: eink (" (ist2 Fre sE:, list 200: D) — Lista (1 sC- [2rgucs]. a _ 63) How can pe remove list element ? — To _yerove o list element, you cn ite _eithus the oft] ___dtatement _or ths _vimove method . | 64) Why "we vse ump (lish 4, jist?) in Python? — if Compan es elem ats of both lists 3) that is the _use_of len (lit) in Python? = bf _ gue the jplal length pf the Lis} ) Describe mex (1s) methook | — _# suturns items from the list worth max value. DY Describe pain Uist) method Ht reins item ffom the List with min ede Scanned with CamScanner 9) What_is the urea list Geq)_in Python 2 7 fL_tonverts _o_duple into list 2) What do you mean by List. append (oy) 2 >. Appends _object_te List. iT ct do ypu n_by Usd. count (ory) © > Relorns Count how many tinea _okj oo Curs in isd. —___ in_Ui W Explains = list edlend Gp) —_ Appends the contents of S940 [ist 1) fe lists Yeuoue O This muthod doesnot sutrn_any value bot averse He given fiom te ¢ nuthod _yeforn _& Value 2 Ais} W)_Which method ds used to sort Objett s of Lied? = _ son) —l tWhids fonction ic used do ceeverse objects of lik in plate _ = __ list reverse — g 1) lohich function _& use for removing object From lis}? ; — > __ lis. remove Coby) 1) Which fonction ig exe for_rebuniing the clowtol jade list thet _ ae Lisl inelur (oly). Oppeasa °. Scanned with CamScanner _ Bhord Arsosur Type Qvertion 2) Define :- Lid jn Python. = The lict is & most versotile datatype cuwa.iluble ia Python ! wor ao oO i omma -s¢ ‘values Citem) befeen quan brackels food thing ohout _@ list is _fhot items in a list need pet ell awe he same type - ating a lst b a simple as putting cliffount Comma -seporatict Values behvetn Aguas brackets. for tram ple? : “ist 4 = [' physics’, “chemisivy ?, 1897, 2000) - ‘lit 22 C0283, ws Nits = [ ta’ 'b') te ‘a: _ 2 five an_txample fo cxccess values in licts. —= “To access value in lists y use fhe squane brackets for licking along with the index or indies to obtain volue cwoilable at thet inder . Fe list 1 = Ct physics’ > chemistry’, 199 7 , 2000) list 2 =[ 1) 212) W506) 75 — pciot (" list 3 Co) 5 ") ist £0) print (ist 2 Cres)’ Vey tidi2 Fred Output '~ _ list J (0) 5 plysics list 2025): (213,45) Scanned with CamScanner 63). Write a pro BY my ld and to numbey in oluacendiag ovolur © — _obf arrange (ir) for_i_in_vange (n-4) : for_J in range (n-i-1) if Wj] > tied: temp = !f)2 IG] = 1 Ci+d LQjat? = temp 4] vite the ouput Ay ths following cetea +2 A = (10+ 1009) 20: 2000, 2 18000, VO: 4000 , 50. sooad print A. jfemsO pret A_- keys U _ vint A+ Vvalvest) > ire ue, 400d) y (Io, 1000), (20) 2000), (50, 5000), (20, 2000)f 1) [uo 10, 20,5030) [40 2%) 1000) 2000 5 $000 » 008) _— Dictionwries 01) How are olitHionevriea diffount from licts? = The OicHoncy is Similar 4p [ists fn the Stnge pal fi —_—_aloo__0_colle lion _af dota itt ju e tists put 1 i diferent from lists inthe e ———Squenlial_collechons and olichonasn; fi collections In_lists whine there ‘eas ped ee with thr olde items becouse they tor olhwi objects or Vor ables atta stor ore _otifforent from Lists ana top lea perouse the an Scanned with CamScanner ee. of objects they holo are notin any panticvlan vel, but | Listadhen teh object hoo {fs own Unigue name, Common t Known ao a ke. 3) When ane -clictinnaniea move_ureko! than lists 2 <7 _Dictionwues Can be much more _urefol then Li} Ex + Suppose we wanted +40 Store -all ovr friends’ cell Phone numbers. We Covi create a List of paiys (phone No) but once tue list becomss tong Lnovgh seanching this L Ya eit ic hoi A ee L Con svming. Beller wovle pe if we Coviol_inolty He list _b our friend's name. This fveusely What a ictionany choo _ | : > What vu the chamacteritics of Python Dictumaniea? —_ Th 3 main chanactenistics of & olichonary ae i= 1) Dic Honarien ore Unordeud_: Thy clit Honany elements (Key —value pairs) ane not in ordwud form . 2) Dictionary Keys ore Case Sensitive: The samt key Name _ but with~ cliffount cape wwe treoted wa Affornt Keys in Python olictjoneurjes ‘ —9_No_ du plicte Key is alloweel + hin du pli Keys : Lntovnteud during assignmunt , the Los t ousl9e wns a U) Kew must be immutable ‘We con ose - _ Nombew or tupleo go Clichonan er gy Keys but something —__like ('key!J snot oWowed . a Scanned with CamScanner Long Answers + | > Write Python progvana to _is ut tn! andl pho number fo store jf ina olictionwuiy anol to input Any nant nd to print the phont number of the = _paxctiwlay _noume. — _fhonebwok = did U n= input _(" Enior otal no. of friends ) j=4 while Ik=n Q= Yow input (“Erte non") b= Yaw inpu! (Enter Phone vo) hone book (a) =b ewes name = Yau —input ("Enter name") if =o 1 = Phonebook. Keys () for jin 4: if (comp (i, nume) == 0) print ( Phone number =", phone book [i] ) f2J Lif (== print ("Given name not exists) Scanned with CamScanner TUPLES = 2) What is a tuple? = _Tuple iso seq yence_of_immytable Python Chjects 2 we e_inclivi le nts? 3) Which fonction ic sect for comporuing elements vf both | 7 duplto? — cmp [toplel, tuple 2) - 4) Which fonction gives the total Lusght of Hu tuple? _—_len_Ltple) in ion, rns item trom ple with max Vvolve? = vat Liptl 4d) “What is tuple? inom Tuple hort Answer type Qutotion + is @ Sequins of. inomubable fy thon objects . T, is Hs. cliffounce is that fiona ls coun pot these comma = er Na lveo betveen parentheses also. Scanned with CamScanner beng Answer (le Gyeotior :- 4] had is My so? — ft is_an_ Open Source Sh tt i ‘abl free of stcost. : 2) Who chuseloped Porras? —> Fdocos frank “Tec” Cootdl . J) List jor 0 be om 2 <=? Mayor Components of database syctums av + D flaxdwcoe 2) Soffrrane ) Data 4) Procedvry % 5) Dota Aceess haus voge 3 WW) List at_leool S possible ottribute for a sfoderit = 14) Name 2 Grade 2) Marks W)_Phon_No- 2) Adolne ss Scanned with CamScanner L bhai Sulation ? Define * the vulational dota mods __ —'n_vulational data moc the dota is ovgan(zecl into jableo Those tebles are called xelations 6) What is_a Primony Key ? ey of o re cattyi by fea thad__can” uniquely teen fy foples within tha ulerlion J What is _a foreign Key? —_A_non-key attribute, Whose valves Gre oltrivecl from_ the primary Key Of "some other toble,_ic Known ao Foreign Key in ts cwrrent. table =) What _do_yoo_unclonstand by Candidate fey? All attribute combination inside a gulation tel can coun ove 00 primasy Key @u Canclidats Key. Long Ansiser Question 4) Describe thu taser devel of data abstraction 2 Thus Awvel of docta_abstraction + D fatornal level: A cotul Physic otpra £ Suche and UL % paths 2) (osital [evel « strucwre_anol constraints for the en bi —__ dadabape - 2) View Level + Describeo veruieus wor views. a Scanned with CamScanner 2 Define: Relodion y Tuples , Primary Key , Attributes . Foreign Key , Carolinality Degree —? Relation + fn wulational data mode, te data is OVganized into tableo - These “lables are culled rela bisa “Tupley ¢ Hows and colomns of a swlation _@u knawn ao Topleo Crienosy Key ? A Primary Key is a atti bvteo that con uniquely iduatify tupl

You might also like