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

Python Complete Notes - pdf-15

python constructors

Uploaded by

anupamakarupiah
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)
35 views

Python Complete Notes - pdf-15

python constructors

Uploaded by

anupamakarupiah
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/ 4
/ Date van | ; Passed as angumeats: % tak (“Maximum f 13-2 12 Example pain (é eens end 3 23,14 ,100)) putok (max (4,19, 43-3104 Le palo {mart t= 100 O/P- Maximum of 4,13, 93:3, 19, loo min() method fs used to compute the minimum of the on... T valuts -possed in its arguments . y Sout fundfon - can be used to souk a Lich fn ascending descending . or usen- defined orden. J gd Syntax - Uist name, sont ( nevense = THue/ False key + my Func) v J sreveise ) method - is a _inbuilk method fn python that ” weveuses obrects of the Lisk fn place fie, YF doesn’ use 3 ‘an any exo. space butik fust modi tes the original Jick. , Syntax - — Jistename. Hevense() 9 ri Es = -_Tuples_in Python - . Python Tuple ts a collection of objecks Sepanated by commas. In some ways, a tuple ts stmilar fo a. Jfck 3 1 informs of indexing , nested "objects and sepetition but a. luple is tmmutable S unlfke Is which ave mutable. To_oreate a Tuple we will use () opentaters . ! Vows (“Greeks "for", “Geeke") ; : paint (vay) [ Seaat . —s 2h . ~ mT Heaney, Values: ftw, Taplea 20 ke if Lae ie — — a a ‘y= Faozin seh aie immutable obfecls thal only Support methods and operators _that puoduce a “itsult without FT afvcing the iozen stk or sek fo whieh they oe opplied canbe done with _4uozenset () method , = Methods for Sels - + Adding. elements 46 Sets - sth add() funckon at UnfonY oporatfon on Sets = _unfon() function 7s Intersection opeiatfon = __intersectfon'() ov 2 operator Ss bitfoence = difference) or - operator | ye Clearing Sets a Clean () method ; 2 Sporat Date .... + diclfonaay in Python - SS Rt fo store & {t is a collechton _o| aN 1 used ioe ee —* dals_valuts Jkt @_map., —Bbfeh: unite 1 ote — _ a an ment. iu hich hold only a single _value as _ types _whie ny 7 _* —_Dietfonary holds key + value pats ——_ © Bist “t d 6 is teample” Sitlis ut “qeeks! Os pout, Ss ‘Geeks! y va i puint (dict) - i t H Se |= Gating a Diclfonary — po eatlng S LC A dilfonatt can be oreated by placing a - i Sequence of element with culy fy badees ; Mhauated i | by 'tomma'. Dichlonany holds Spates of Value, one ~ | bttng the key andthe other torrespondiing pair element, bein’ ths keg value. Values ina dicHonar can be of & any data type and can be dup fated, wh®reas keys can! } + ° u be sepeated and must be immutable. Se Pi - __NbIE - Dicfonaay keys ale. case SenstHive; the same name -“ | bur dfhtuedl cases of key will be baeatedl Be | distinchy. g 3 d Fe Example - Dich = 61: "Geeks! 2: ' fox", 3: Gecka" 1 cS ; - ! pafnt (“\n Bfenary with a User off tnkeqey “ae keys 3") 2 ‘Ja 7 paint ( pict) ‘ aos Dick = {' Name's ‘Geeks 1: fie, 3.47} = | faint (* “\ndicHonary with the use of Mixed keys:” ys _patoh (teh) J sh as al Py be : Diaionas with se_of Inte er ke ‘ ve re OFT Wat fou. 94 Syeeks'} “s 5 sano eT the use. of Mixed keys : {iName + Nyeeks! tb St 41} i I the built -fa function WF pialonar can also be ocated by it An empty diconary fan be oteated by just eee cwily “baacesf Y- Nested bietfonary, - ena T pid = $1: Geeks! & For, 32 f Als Welcome’ SE oi Jor pies “geeks yy a) paint (dict) 1 tere ti tgeeks! gt \For's aigtats ‘welcome’, O's TOL cs ae : cyeeks' 5 = We Adding elements fo a Dietfonary - Tone value tan be adged to a _Dichronary by withthe kty. Eq Dich [yD =" Value! J U a) detinfag value along gv d Updating an eyisting Value fn a bicttonary tan be done ages ib using! the built update O method. re Nese? Key Values can be also added fo an existia DicHonary. “ i o g — fecesstag elements o_o DicHonary ~ m order fo access fhe them ofa dicHonary viefor_ fo ks key name- ei can be. used — fnside Guare 4 x bsaces.

You might also like