*Assignmen Operataxs Assiqnment Operators are use ton yaniables They include
* ogical opgakors
classMAte
Equal to [E): Assign the value on he tigbt to the yaiable an the a.
Date
Campaunda ssiq1ment opeators(=,-s t) perfom he pecihied artbnmetic dh erations and
assign he rEsult to vahiable
Page
assign vlues ta
loaical operaars in puthan are used ta perfaxm loqica Operaiasa S-on Boalean values
* Bitwise
logica) AND(ane): Retams tue if both apetands are tue, otheruuise false.
Qperasotg
Logical OR (o):Rekurns tue iE both ate one of them is true, otheruise false Logical Nor (nat):
Returns he opposike boalean value af the opeand
binars humbeLs Brhuise aperatats perfaum operaians on indivslual bits af Bi+uise
AND):ferfoums a bituwise AND Qpetations on the binany tepnsenhaians of Hhe aperands
Copyrighted by CodelithCuvious ·Com
-Bikuise. OR): Ferfonms a bituise OR aperation on the binaus rep ESentations of the
bperands
*Mebership Opctatars
Bituise XOR(A: Perfoms a biBwise exclusire OR operation on the binars representaion o he
operanas Bituise. complement (: lhverts the bits of the opetandr LeFt shifl (k) shis the bit ot-
the left aperahd ta the e by the numhen ok positions specitied by the right operahd
classmate
Right shie(>) shift the bit of the left operang to the vight hy the numba ag positions
dpecihied by th
Date Page
Membesshbip aperaors ane used to dest whether a alue is a member d a sequence
entity Opetators
n:Retuns thue i both gpetands reer to he same abËec (sequence) Not In Returns true boh
opetands do not reters to he same obiec Csequence)
dentits Opetrators ahe uced tn campare the. identity o twa ohjecks.
chjed
Is Retuns Trie if bath operands refer to the same obiec do the same abject ls i s not Returns
True both apelcnds da not refass to Copyrigbte by Codewith urious -Com
Lt List
4List,Dietlonar set ahdl
with commas.
classmate Date Page
Igpe onversion
In Puthan a list isa veksatile data stucure Hhat allous you fo ore and organixe. mulliple items
in a Lsingle variable. Lishs ake deined bs endasind a sequence of by a Lists in pthop are
otdered callecions o elemenks ubere each elemet is jdentied by its pasition or index. lists
are mtablewhich mens_ou can modiy add or kemoye elemenks attar the list s cteated ist
decaraion Tn putho. you. can cleclare a listby endiosing a sequence Lo elements wthin
square brackets () Here ate a feu [Link] hurabers =LR,3,4,5 FnuitsT'apple"," banana",
"otanqe", "qape"
Ti this example, we have two Jists. The numbers list conhains intcqer s, 'specificaly the
numbers 1,.3,44 Copy righledbq Codewilh Cuvtous -Com
eements uithin scudie brackets I and and Geprating' Hhem
c./,[Link].
Date _ _
Page '
,,,- ---tt------- ----- -~-- --------
CopJ r~'nte ~ CodewiihCLrr10LIS
I
Con1
/--- tt------------- - ----,----=-~--
Cop~ ri3ht~~ b_g CodeWi-lhC~rious$ Com
' II h
•
Cop~ ri3hte b~ CodeWithCun'oL(J · Com
• eJ
ml: inside ano:l:ber jt _.s-lukmeo:l:, c.1:Ea,-b5 l}}Ul1+·1rle levels
\, or cooctAions ood d ec1sionlS .
e,
F Bloc.k
SK)p
be exe ihon i-s true,
Cop~ riq nleJ b~ CodeWithCurious j Corn
-fg
"
q
I qnatber b\ ads 1
~ ress1·on if Block EX te'5si'on / else Block
c./[Link]. ~ ,_,,
Q Oate c
I•
Page _
at - I
Floul~htt ,i
I
-
I - I ffiar.\-) -
...
I-
/~ I Hl\.~e.,
\ ccndiho~ I\ I
\ / / -~~ [Link].
\~3/ /"\ I \8/ / ~ ~'\.
\ --g 1/
\3/
lfoe.. Tr11 P 71'UP [Link],
,,. ,,. ,i,, , /
E-xprnssion/ E:xptess ion/ Exp~ess iol') / Exf>iession/
i~ b\ock Else-iF bloc.k Else-W block El-s~ block
~L .L
I J BtoP ~,
S~ntax:
I' -
.
if rnndi-hon1:
e\if conditioni: ✓-
#-code -to be exewk.J i candi-lJonl is 1m~
=It coed e -1:o be ~~J ,1 co nd it, ao t ,:s l-aise , condi'ttan2 is !rue • ,,
.,, e\i rnndi+1·on3:
=#=coc/e to [Link] J condrJt , condYJ .Q. ,:S -ta}se,,, ({)nd,lJorJ3 is /rue· _,,
/ else:
=# coJe to be exewle. i al{ conc:Jitlor;s ctre. 1o)se · -
Seo e, = 7.5
rint '' Excellent ''
e\ 1 aroYe ;,,,=80;
t\nt C' Ve~ I ''
e
I"
_,,,,,.---ti---------------- ------
n1 :
e execuJ · mndi-hon1 1:S ,hue.,
e eat ,·tionl co i·hon~ iis +rue,
ion f 1:S fct~e.,
8'Qm e.:
income= 50000
- 18 :
/
for ct loa.n.''
e ·.
for q [oqn ''
else:
tint " o re. no+
:=--.!Lil 6...e.~s;U~LQ..tnLe_:r±:u~~;~~!LL:ruO...:__cb_e_ck_.s _i\_ 4h_e_ r n_co_m_e
_\,<_s_8_ff_ ' _ _ ct __
~ --U-----------~---:--~-----
Cop~t~h-led ~ CodeWi lhCLtr1ous • Com
---- -
___ l=--_-g-::;:_-l:oop-s __ _ - ------
--I --Ii-------------------- -
..-
1
! . r~+ho1Lf JOYides__sev_er_C1l½pe.s_oLLoo ps--l:o -cq./ er -
---·-----+lo. d1 FFere~b_ loop.i_nj-nee:ds_:_Jfiese_/oors_ of fer_dj FFererrt ajDk
---1 _ond __ c:ond1-hon_=_d1e.ckin3_ofip1o_ac.b_es_:_wbil e_oe.rvi ~_j-JJ e_ _sq me _
--· I p-urp.ase_ot-_ [Link]-l-1nj_'9ta±elTienb__1_ereakcfuJ-----
'
______ )Jne_avaiJqbJe.[Link]-5-i.n_pj+boo_art:...::~--------
~----, 1 · While_ loop : 1±: repmenls~o L3toup_Q-t_ ~-k-~ent
_____ _ .a_s_looj_as_a_spe.c1{1..eLCOJ1dJ±i.o_o_t6....±rue_· TheJoof _bo~ - -
----,'. __.i'[Link]-kd_o_D~ - i Llb~con _di±LQ~is ___ eval u ct+e.d _ ct6_ +i u e · -
_ ___._fL_ for_loor-~--IEJ~ loQp_j_~_ us.eclb__ilerale._oveLa_sequence. -oF _
_ ____ I e I em edts_,_s_u_cb_a_s_a.__Ud__o r ah LI?9-~LLsim fl if( e.s_-+ b ~ mq n-
- ~ ~[Link] ?t -tb~.Jo.o1~au_ctbLe_ ao_°-e_xe.cU~_a_ code_ block _
___i_:Fat__ectch_Jk1n_1n_±b e._~~u_e.n_c - __ _
- ~--N e~ted loo f __;__i~[Link] o.l to_ul\5_ ll(Lj:O_b qve...J o°f ,s___j VJsid e., of her_
_ _ _ loor_:_lois_ Cb,O_cer. of nedin.9 _ _\~F- eDqbl~ 1..ts +o J-ler~
___ j"hlOU_gh __ muJ+ipje,_\[Link]~_:itcrctl:ion___, e1teo1+1~ _ a_ _ loor w,+hi ri
____ qn o-fhe.r.. [Link]· ___ _
•·- - •* . - - • - - ---- - • --- - --- ----
- --~ ... Pctss_Bbtetne.nt_:_______ ___ _
--·-=----___ _In -~+hon Jhe__FQ&, _\Shl-lement i.s q r'[Link] -
--•· Si0t:h1en+ _+hut does no+hi~~-It _i-s U\Se.d when a. ~ernent
.. ,s s~n+[Link]~ _ reg_uire.d_ bttt jOLl don·-h WQn~ -l:o [Link] -
__ . o~ adion or_ w11te, <lY]l\--code u+ -+h J f°'rr\: · t o.d-s
. _ 0.6 ct nt,ll\ Ofera..\.io n ctn cf hel r.s in mqirJtO:ininj --lhe.
_ _ .. 1Stfuch1re at r~:1ram•
Cop4r19hted ~ C'od~WithCqriotts , Com
-- ---,,,. \ ...
___ --tt"i --The_ ~5s__sJ.~kmerJ-~_IEL~c~~mon~ used as a.
~pJoceh old er__ -f'oL code.___ -!hd-_ w!l Ue _i mpl em enied laf er or a-s
--'t;
1
----pl~celxiLdeLfoutnf½J -fund10n&_oulassas. I+ all~ws 1ou
---~Cl-. Wl tte_valiclrode._-1;Mhoilue.e~mm ed iJe I mr \em 1chl:-
--il QtlCD ·
- I'
etnon~qle_-lhe._Use_o~_tbe_P~ -~ktcmerJ_: __
L---+--- . C\_6_ - \qceholder -fur _f~re_cod LLn1rlelY1en-k-t1 O Y) -
,j I .
n ():
.----.,.tt----+-=--q ---1- [Link] er :fof coro k_ruJ_c_9J ~---_ - -
________ c~ qss M c 'L-""-'-ss=-: -------,-.....---------
~---tlt----i----=-'-"''-=-/-J--f-'~=-i=...=~::....,_f~ a. ss ; m pl e.-men .fa1·an. ___ _
- -~-~LJJ/ii_luQQf :---: -----------------...;
--___.._ ____ _J~,_.__._.\e----""wbile loop in P3:thon re1_en:t_ed~ exe.c.u±e.s___
Cop4ri:1h-t~d ~ GJ~withCurious · Corn
._
.. ·- - --- - ----·--
.. a. [Link] cf_ cede a.s Jo~_as_q_spe~ifiel ccndJion. rerr:ai:j';-,
-·hue.· ll ~05}s _ -¼he._ cond,fian_ beforel_each _,hra-hcn._and_ C:,uiJr..l:!3
-lo e.\-[Link] -the cede. block un+ill __ -lhe._ccndihcn_eval~a..+e..s_. +~ -
fct\S€.· ____ _____________________ _
. Exomfle. ~- ________ __ -----
_ CcunL. = o ______________ +-_ _ _
__ _ whil e_ collnLsl,._~~ = --------~l...---- -
- flir.-l (coun.f:-J ________ _ /-- --
[Link]-_ t= 1 _____ _
___ Here~¾.e~ndi&;n:__ide_~te.ss10n _ _oLconditi0,;_-fhctLis _ _ _ .
'----__ e,alua~Ed_before._eo.cb_i~ler_q_bJlJL...JF ibe_coo:li-h·~o_fs _-:-rJE. J __
________ ::fhe.._code_bJou"-_i-o _execukd- - -1- - ---
-- _ IL+h ~--coodi-\: \Cn_js._:fufse.--,:lhe_lo o p-1:.s_el(Ctt~_cm_d _-H: e.._
pt °JrartL cont·nu e_s_u)ifhJ-he_n exLtsla!ement_ aR-~-fb e.. In~, -_
------
---~nMx : ____ _____ __ _
l
G · -2. ~) l .:-)'"' ;
I
lfie for loop in pr,on is ~sd -6 ikr~e...
oret a. ffijuen£.e o-F eletnehhs , .Sllch as a !is!-, ·h1f1e. ,d-i:YJ,
or rar:5e -
I-!: alloUJS 'fU. -!:o pel~rm a. Get or actions ~r ~ch itErn )I')
itle. ~e_t.l ence.. . TRe. locr \'OTi<l.b le, -l-~\es -the. value. 01 e::tci)
ihrn in -H1e &9L\el1ce · one. bj one , until\ -lne ..se.1uEnce is
c~p ti.:J--~2l 2d [,:.\~\',~:~::,~·:"'~ •:.:n'
_ -[Link].hl_. _
---------- ---
- - H----:-----------------·-- - - - ----
1·
.--tl-+---LfoLi.tem_ln_ ~equencc:::.,__ ________ __ ,
___ --+l - --'-' code.. blo_ck J - ~ -----------
I Hlli.Jb_e._j tem rept e£etl:bs__J1b LJ O Of _lldri ab ILihctl--
- -++-;' ........,,_ <1-+-\.e,s_-lbe 1Lalue of encb i+em in -\he se~[Link]~e-llie__mcte b!od.
i----t+---'--'-1-filde_±h_e_.lQo.p 1s ex&.uk:[Link] LeQ L~ rn I n 46 e_ s e 9 u en c e_ ·
• 'X \e1 : H-era +e ov~ l.__ ______ ___ ---:
~ - ...,..' 1-fl_,___,_t~ppl e. '', '
1
banana.'',
11
chen;g_''=1--------r-------,
-- . . nw,·..L..,, -L....'.....: -----------,
·n±-(-fruit,J-------------r---
lL !
,,
Ii
- - ---------
ii
Coplpiqh{ed b~ coaewd.-hC~rio~s I (orn
.9g1_
--~ £xc:1m le. Z ·. lletale _ [Link] ~ a ra~e ____________ _ --- -~------
- _: __ for_~ in _tu1J9e(1.5) =--~=-----_--_-_--____ ---=--~-=--___ : ___ ____ nnt ( ,) _
-------~ -- ----- ------
----·--:~-0 ut._: ------------------
---' __ 1 _________________ ____ -----
-t -··· --·· - ·--------------~----· 3 - ----- -4--------------'-
------- ·:--- --------------'----.-
. ---- _.; -----in-=tbe._aho_ve_~ctmfk~_be_.rg,Q_ge.,_(13)_-Euncli'on_
. ---·! _9en~rates_a _15e9uenc.e,_J ____nuro\:ie.t;s__from_ i_-f:o _-1, ( exc\ucive) __ _
. ----~e-loD?- Yar.1oble i ~hes~t\1e.__rn\ue. 4-~cb-numb_eLi n_::the
_____ -~--s~uenle4 _and _ _4b~-rrmlCi)_~krnen1-_ 1nrrk_ ea.ch_n_vmbex_. _
S9
.--, behiieeruoc\i-~;-lue in _+h ;-_ ~~juttice., _ - _
_::=l,1:mro Fle Lllera.k-Ovei _ q _ Yd~ e { humb~
--r
------rtF=;;:======:::;::== ========== --
____,l_foLLJLIQQg e_( s_)/ __ : ____ _ _ ---
__, _ Prinl.('-"""ri) _______ _ _
1
1 r ,, -----,J-__:_===~=======================----------~j_Dufyltt:--: _______ __ _
0
I 2...
' .3
i--------+-; Emm~LU leta..k_ltli-l-h_CLCYJom_rctt:i2e.-_ c\JlLcii-cr-----
e---- 'l i=====::=:::;===::;;:::::============r --
r.---~ ' _ lti_j_o_ ra nje_U_J. l O 1 ~ :
r.--------....i-,--p_rio± (i) _____ _
r- -.Lout T,( ~. ----------------.--.!
'1
---· ('op1.(dqhte. LtYIOLlo • Corn
n_4hi-s_ exornp\.e,Jh;_r~~~ ( 1, 1o ,aj "tuncfion _g ener?-fe.,s ~ . _ae.[Link].,_ot-;_niJm~ers
_-&om 1 -1:o. __9 wi+h ~ e-kp -s1~ or
--L -t:.Jli Uoo p_ vq nab lei _tq Ke:s~ --the val u.e, of &ch. numb er h' n ~--
±be._s~~[Link]._,_c:tn~--±be.,_ pnnt--C0 ~knent:s ~t1nta eQo
_ _ t)l-ltDbel ·l I - - ---------
_aL1'i:!l:ii e---Du eLln_,sei:JUebce-ou.: r : ----:#=ouJer la_o_p_();)de-6\Qck~. __ _
.--- -i----~o~~r ~Vctda..bie_1nne.L.1~[Link].-inne.r:
____ _ :=[Link]/.oop_code_block _ ___ _ _
--___ ,.,____ ___________ _____ _
. -- -··-------------;-
-_. _____ Here, Variable__oLl-k represents -I-he loo f vorio.b le
-3uvJhe.. ou.-ler _ loop , .an_cLsequence._ou/er iG -ihe ..se1uehce over
_ which_ +he. [Link]-lo°F 1!:e.r~
. Exam f le'. _ -
_ _ ·-· for i in raQ_g~ ( 1, 6 ·.
. _ fo1 j in rq~e Cii6):
pb"\nt (i * J) end& " '~
1rint0
Cop4r,9hteJ bj Cod~Wi'lhCun'ous,C'orn
~-------
.----;;F==:====== ==== =========r ----~·,. 1 ~ ~ -5 ________ ________ _
1 6 g /o
--~r--3 _6_9_:_\1-=15 ____ _____ _____ _
, '1 9 I 2. I 6 .zo
II
I
"
[opu r icihted b4 CodeWithCtnious -Corn
-----
------
--~--------------------------
~ :i 7· Ll,g:lhutL~S~i~L~D.8b-------------·---
!
- --- - ... . - - - -------·
(op~ r iqbled ~ CotjeN ithC~r10Lls • Corn
II
; &trl ~ I l\ello I 0//= siri.9/0 7110/e,3
; eh ..'l_ = I Wo r)<l ' -:-//· JJocihl Q. 711() L PS
:I \Sir.a .. i1 "" n_1\·l11 on I" I ,, ,, " ' I l ,-. r I~
1ow e.r LL l~n.:JU.q:1e., ~tf ·1ftf e 7r.k'J e.s
!
,1 f rint ( ti r I)
;I ein t ( IS/ r -')
i\ r1nt ( & ~~
:---- -------- -------'
!i duJ-hu.~ : :j --.!f' -
,, Hello
; )1'\ot \tj
11 f.~ I noY) is r,ow er / uJ \an.3W!8 e..
!! In ·lh_e._a_bo-ve- ex_e1_mr-1e.-, _w_e_c._rea_l_e, _·lh-re:,__e_d_i_rl--1er__.[Link]
\Shin_9.s ualn.3 .sin3\e 9u.o !:ea, double: 9uole;, ond ~[le. 9u.c~e,s
. , A\\ -lfae.e. wo,p d. re valid fo1 [Link].~ filii0_315 in fl tho n •
T 7·3 _§h·,o~~ -,r}_cl~xJn1. and_ spljlL1hcJ :
,, In r~lhon' ehin.515 are. Indexed \Sior H·n9 frol1l o,
1just \ihe \n ma~'\ ol11eY pro_srqmrni~ \dn.3UCA.q_~· fay lnsict.Y7ce.,
-\ne. '3hit5 'HE.U.D' can b~ l~d ex~d QIS ~hown below ..
I
i! IS \.r = 11 \I E L 1.0 ,,
I
I'
I
I
Co pq1 iqhlc,c\ hq CodeWilhCu11btts• Com
---
------
----
-==-~exa air le_,__eacb_lelkuif_±be_clr_j 129 _
11
~Ell{) ". il'l Q6S~~~ [
____ _ao_ki_J n_d~cl.in3_iron1-o~ __ ]E.e.J.e.H·_e,L1-LJs_QL1 nd ex_o '. __ E -J.S
___ __ [Link] j, ''I'' 1s_a.Uod_ex 2 o..[Link] __ on_· Understand 1!l.9-
--Stl.L~_incLe.tin9--1:S_imP-oi±qn_~_be.o.e0tus_e.,_it_Qlb lJ-}$ _yo LL -lo_o.cc:ess -
___ _q [Link].o ni filla:le....llf kif 1Jc._Ch a [Link].s___ 1;,,i-l-h in d. ,s-l-r i' ~ · - -
- ---
7·Lj ][Link] -\be \Sh:iQB _____ - ----.
1- ---------1.o_pJJ±hnn~a.n_d_e\e,-\-e., q_d,,i'l3 -~ - assi
_ _ · =3nin-5 i ±: -the ~olu..LJion~ LUsi:Qg--=th e._d el_k ~word ~-- ti ere., _
__ Q(e %Uo me±ho_ds to dele-tf;_a_cln115_· ----
---- - -------- ~-sko_g = '' ~elLo_,Jdo.r~-'-' ______ _
____ _ --~ - _to~ __ Ju·123-=-[Link]'-----------
--
___________________ \[Link]-s _method ,Jhe. _variable.. m_g_~1'n3- __
_ ___ .. J-s_u-s.s~n~d _ to_v.a!Ll~_None, ett~chy~ _deJf.~·n~ ~tdn_g ·
-=__. ~~-U6~ the •a·~-k~~6~J. -
Cop4ri'qhleo\ b~ Codewd:hCuriou.s · Corn
--· - --·----·-- -
ii r = ' Hello' ~ -------------t--
i:.---_____.__,t----~ = ,, WOL .L.=d_''-------------t--
eouH- = sh + cir 2.
--~Uepe±i:b OD C *): lfi e_1E re-h [Link],f mtln r is u..-se.d to ~
,_____, __ ~m-m~\e +irn __ . _________ _
c----,LfxqmpLe..~: _________ ______ ____,;
1 == '
1
He!LQ _" -------------+--
r--~1---~~u.} t- G'tfj_ ~3--.-----------1---
----1----P_rhJ±:_ltes_tJ-ll)_ -i.E ~ct;; t -1 e Io ell o
Lo f~Yi._g hte()\ by Codd-4ilhCurious , Com
::=-~J~d ~i~( [J) ; Jli ~~ i~d ~i~ or era.f-o r ullows you. to Q cce:)35--
- indua [Link]£t~ _ ct C\ :shi-'2'3 ~ +heir f°~Ji i an ( Mdvr ·
---
,----;:bqmF le_~ _ _ __ _ _ _
-= F _=s==;:_=:J:_-==:_"~H::::;:_~\\=0;=11 = ===========l
~--...r\n\:Jclci[o__]) =ft o~~ ! H=
_ _.,.~[Link]) * 0111¥~~ _ _1.__ __
-- ---...----:-~----=--- - ----------;-·
_ ~ S~dn;l ( [:J) ! ]li_~li__ci~_opera{oLis_u-[Link] to ex~c~ o.
__ _ subdrinj--1i:om_Q_1sh-in..3_bj --[Link] bi in_g Q ra ~ e. or ind I ce.s '
Fxqrnl)\ '.
- -~CLL..L--'~~,_wom~''----~-------
--t--~[Link]:t_(std [6 ~ 11]) =#-ou±f Ltt : W~rltjl-----
. -----
__ E--xqmple·-_________ _
6 1 = '' Hello __ Worl ' __
rim-( '1v-Jorld ~---in_~td) -[Link]: Tn.t~
rint ('' p~thon '' not in sh!)-=#= output-~ Tru ~
rint (" print~
1
'"' d-ci) # outJut-~ pq/ae.
rint (" He\10
11
in $0 -=#= oiuJ-: [Link] _
Lop4r~~lJ ~ Coc\eW,thCurious · Com
7
-1-:---8-· Fun ciions
I :· ·, --- - ...
. .. 1;--~.'. t __ JundtQQ. lD 41\hon :_ _ -~ __ _ ..
. . -- It-·-------·----- . . . - - -. -
- ':-----------_______ Fqnd-ion() in Pjihon are [Link] ot reu6e1-b_l~
_ -· .. + code__+fttt r~-to1rn . Q -[Link] ti"c _ -\a,sk, lf,~ bel f. in 0~ cin,xl~
_
1
1 ancLclr.u.&t1.r~g-pr.o3to.rns_~_bce.ak1Qg _-+hem_c\own_, nt-c [Link]-
.. ---;\--u\\e_L,_rnore. __ man~ab\e._ Lark. _ d
___ i: A_funckon i-s_d£tined __ u~in..5 _-}\-)e_ def-_ k~wor .1
_ --....: ! ..........,~olloweclb11__:lhEc._Jt1nclio ILl'lQ_mcand rrc:m-lh e.-s i.s . A fllJ . r e4ui re.J
- ----tt---'I I ar~grnml'k.~ qte_ -6?-➔e.J_w Lt\:lm_-1:b e._ pct rq rrt\i 63 :-s j r --
: lE e._b_o_clj_ oJ_-lh e_--fu n_d1 ·o n J a._i n~ e tl tf.O.. dJlct -
-~'· _eoo±ains_±b_e_c.o_de._·[Link].Lb_e_exe.ctLW_wbetl.=the_:fuod-ion
I
- ~ · __ lS....____,_CQlle.i . . ------·
; RmJions_~um_valu.es_Usi ~ --th e._r~tuto__ _
--~'. , ........ Sta~if~tnenL_wbich_olLQLDS___Tue_Jimeho b ±o_pQs.s_bct_ds_Q__te_lSu. L-l
~ ~-a t-1nfutroa±io n -buhe_cct lle.t_· )_f_Q_ }ncb~o b_ do es no-±-_ have. _
_ ___,__,_, a _re_-½ m_B"hakm ettl,_LLw iJ L~rJL_N.Q.ne_ ~ c\~ f u.\-b · ___ _
• lfi~es JtLfunc:tLor:U_
---·~ Built-=: i n_f<lnchci-n~ :_ lne,se _Cl~--r~= ~ ef h~J -fun ~ti on~ thQ-1-_q ;,~pro -ad~J
_ , b3 ~on_ Jli~__ate_t1'.[Link]~ _ovaibble. ~out&uoithu~~l,!_~
---,-.-, Q~-'[Link]±[Link] d ~~ B Lt1.l±.-=_1 o. -fun c:-B o ns_ca v er_a_ _ _w1de_~_rctt~j Lal
-- i £ m&ioooli:k03_c_Such_a,s__rrLo LQ,_ I en iLra 119 e.JL1-10 ,Ll+ LLQnd_:§ r e._J ~
_____ __Jf)e-s.e.._func._-tion-s __ are __ accessib\e-_~hro43hou±-_ -the_ ~tboo_ f~-ITLrn
• U-se.c.& kg_J_functi on~ : ]oe15e_funofu n~ _a_re __ [Link]~e.,_
C'oe:J t1~11te.J b_'j Cod~w i-lhilincll3. Cbm
'I
48 .
I
.J, --- -- ----
----:: ~e -pro~ramrnedo rrfuy~ -sf ~it,c -¼sk~ -ba~ ;n-4h,e rr03ram
---:;_:,S_ .r~uiremen-\s · User-. det1'ne.d funcli'ons heir _In .break,~ douJn
--;; o. f1°[Link] ~ inlo ,smaller, rriadul Qr corrr o ~erk , ~ak i ~ -fhe_ coJe
____ _ .L tnore. or__gan1t(J _and _reusab\e._:_ User ~deft'ned _ -[Link]-100-s Qre called bj
---+- ~e_iu ~mas, and _Q!:lumenl-s CQn -be.,__ [Link].d _inl-o _-\he,_-funcl-10 0 .
--·;-'T-re9u1red-_ __ ________ -·-•-·-•-----____ _ _ ___ _
:.-----·· - --------------- ----------·-· -
:.....----' ~· U-s uhe._d eLb~ W_OJ_d-=llil\o wed_bj_+h_e,_f unc~· on _l) am ~ to .define, .
;.....-----,--, ::thuun_chan · For ex.qm1le.-)_d_ef 8recl()_' • -· ---- --- ----
:..---~ ~.:.l\dd_ra1enlheeJ?s._affr_±b e_ftm_ckoo_n.am e __ lo ...def't'ne. __ a ~ -
'-----1rq tam.e.:\-er,S_jb_e_f_unct10.o_m_q~_ a_ccef-L: . .F-0 LE?XO ro ple.,.,. def j re~ [ na~ :
~--SJJse,_o__co Loo__0)_lo_Jnd i'oxk--fbe_~--l_oL-+he_:func-tfon_~ _ code
'----_ ____...6\o ___ ,._, _______________ _
=-----½_._· \ndeot_lbLcode-6lo_cL+.b_d-_ be_lo_n11a_icLihe,_ fu nctfon __ u~i !::]
___ sr..ce.s_ oU:ab~ • ____ _
'----~_l,,hi~e_1be._coda_lho.Lyo.u_waot_-\:h_e__ fonci-i o_n_ to [Link].
---G~Orbona\~ .,.[Link]~rekto_s\-o.km_ent-__ ±o ~rec\~ -\he_ Vd.\tte, -lho.t-
_ -\he _-funcli·on_ shou.\d_re±uro · _ _ __ _ _ _
_____ . 7: Gill -!he t=+ion_~ _1.1.si03_'.tts_name., 1°lloweJ. ~ faranihese.s
____ _ __ Exnmp\e .'
deF 9ree.t [name)~
prillt ('' ~e\\o, '' + name+ '' j 'j
· _sied ( "jo\in j -=/F ouJ-rul-: He.I lo , joh~
711 ----~------------------.---
1
(' • t ' •
I
I
~ ;I -
. ·I
y- ii
---- -- ----- - -- ~
:=· .]/-__ g-_. ~---.F-un-c+-,o-h_-o-al_lt' _o_g _ ____ -__ -..
I
~--1 _f uncl-i'Qri_cc,.l\ ln.9 j n-~~n Is -lhe rocess ct executi '!'.I a def; n ed
-~ _f~n_ctlQ_fi_bj_llSLQ9Jts __ oome -followe.d bj pa rq n+he1S~ · Whe n d .
~ functfon.Js_r.alled, -the. code. in5ide -lhe. -fundim s code block 1.s
1
_ex-[Link]--~. ·------------
1
__ - :!_To_o_-.a-aU-a---:[Link]-cH-. .o-□ >-fo-_-11.o_LU_-)he,se, ~f6 :
I
~ -i1:_ 1,,hik_the_fundion_cu1Lbj_Usin_g -the -Func-h~~ name -followe.d
=----' ~fQtan.-[Link] examfle ,_greet_()_. __ _ _ _
:.--...._;-?~· ltle._fun.cb:oo__acce~-a~ _ [Link] or 1arame-ter.s , fct&S
,.____,! -=1:b_e_m_instd.d~mth ffiBS_ · tor_ exam p \e , _:l recl: (''John)
, fxgmpl :
:..___--l----'"........._8L€d:J.n_Qffie.~>-: _______ _ - -- ·---
_____ not( "Hello, l1 tname._+~ ''~!-'' ---·-----_ _
_Brre±-Oo.b~) =#=:ou±pd-: '' Hello_, Ioh n 1."
:-----------n_..:thi:s_exomple,Jhe -func.-hcn 3reet IS defi•ned
,___JJJi±b_one_r~ram~- ~ame_:__ 1n~ -function i:s _ -+hen called. with ihe.
---ar3ument_ John lns,de._-the rarr1n-fhes~-lr,1s results ,n ihe,
:-----i• fund-i'on-1eirzg execu-kd qnd 1rin-h~ -the._gree~.Qg mess~ e
=---1-" Hello, John l :__
----...; 8·· z-_RettHO Si~km~rrl-
._ I
--1-i--Jll~rn ,shkmen~ in ~-\hon iG lised to -srecir\ -the.
----l_vo.\ue_1hoJ __ o func-hon ~ho(,lld [Link]-It allows o. ftlnc+i'on 10
--ii----
11 il lop~ri9hkc\ b~ CodelvithCu )i'o us , Co tr,
so
L-- -+----=ue Q! _nur.nheJs-Cn_urol,_1111~_,___; _ _____ _ _
~ - -+--s_um = oumi±nurn,..__· _________ ___ --
6')
__ ...__ __________________ _ _
. ____ _ lfie_tehun_s6km_enLa.llei4S_fan..cli 00 _10 __ b e._ ~ore,_ ve rso.-H \ ~
t-----___,~ _
1ro-'ltdi03_a_w_~_ta_ Q)JnmJ!nlaJ.c__ resLL\h __ oLdctk ba.c\_~_ 1:0 __ _
_ ----'c~\\\Dj_ CO _~ · ____ _
--= ~---8.'_1:LScoFe-~ )/qriob\eG __ ______ __ _ _ _ _.
----------------- -- --
-·••-· __ Jfe_\.3cope-0Lo.._ve1riable., __ Ln. f~+hon refer6 tQ -!:he. __ .
_ t ~ ( on_ 0 F_ Q _ f to j IO. IYL uJ here :!he, _ Vd nab le._ fa rero__g _n i ;.:J CAO J CO.I) .
_____ oe_ct.[Link].d·_ [Link]-krrn1ne.s_it,~_v,s1b1\i~ qrJ\+\-ime at. o
-·-·· variab\e_ within Q fm~ram_• ____________ _
__ . PjthDn h~ -tu]~ ~i~ ½f~ -ot: vcttfqb\e 13cope:
- -- - - - - - - - - - -- -
._. __ .. 1 · 6\oboJ .scope.!. Van'ctble~ c\e.t,nd au+.sid~ o~ q ~ "f1'1c~'cn or
-
Cop~ rfqhlJ b~ CodelVi-!hCt1n'ollS•(oM
- -----
------------------ -----------
. or cla~a~e._,g\[Link]. ____ __ ------
------
-l · CAL S1Dpe,: VqrLr.tliJes__le~J~nside. ;iunc~o!L hqve_ ~[Link] -
,_-~cof e.· ln~ate__o~s_sihl.LWilliinJ-hat_sr~if1c_-f~lnctl On . -
__ ____._o_cal_yruiable.-s_hcwe a [Link],_lim\le.c)_1o_ -llie_duro.11 on _of _-lhe.,
___ -.£-unction cn\[Link].iio_n_comp\ e{e,~ _ &ec.LL4io r1, +he locct( _
E __ __.__vmiqb\ea Qre__ckshoye.d· _ _ _ --- -
- 0 . J_e~--------
or = .'.(O =#= Local [Link]
e-- -ff----f=--'-t..l..J...L.l...~.,,_,..,a \_ya ci # Ace eos i'l3 £fl ob a/ var( Qb I e,
l'-----fl--_rinlli_ca.1__v_a 0. # Acce.'5&i']g [oca I Vq rt'q~[~~----
----fµ.Ll~ Euoctio _
fJiDW. glo.b.a.L_v_ar) # [Link] n__g 3/oJ,__g_J_'{aria.b/e.e_ ou+oid e._ i:b.e_ [Link](qf2.
- -· ruol ([Link].).lE Error: LQcctj_J/cm·able JS not qccessible, ou.-fc,·d~ _
_ __ .. -tbe_-fqnd-ion •____ ___ _ _ _ ____ _
- --------
- ______ _In +½,s. examp\e.,_3\060.\_v~r 1s ct._.3\aba..L_vcaiabl~
---~n_b~cc.e.ss9:.i _from_bo+h Jn~ide.. and out\Side_ +he._ tL1nct(o11_
-. ---.Joca.l_var_js_a. _ \oca.L va1iable,_1h~J 1-s on~ o..ece.&sib.lei_-lhe.._rn~ .... -
- -_ _fundion_fun.c½'on~Jrjin--3 _tQ_ [Link].s loca\_ vcr(__QU±[Link]~--[Link]~
. _______ \O\\\ result.-_Jn __ OJ) error __ [Link].use_ ,-h_is_ no+_ in -tne._sco1
e.- _ _
Cop~r(gbkc\ b~ CoJeWithCmious• c~ll'\
- . 3· t lnhodu~±io,1Ji,Jile Jnfutt oulput \ --------
-----· -· --__...-:t
------. -----l...L\e._jnpul+ou}p~t-:-lLj_Q)_te~ers_-toJhe, -rrocess -aF -
-----~o.~dQk__from_an_d_w t1itD_B_dc,ih_1o_fil&s '.__ In_ p~-thon ,-_ -
. f, le-YLulLows_yoLL±o_w_a1Lw i±b_e.<lern aLfr I es_ slurecL an ~
_ _ _,_youL caro.p-ukr 's d1:sh.:_lLei1_gblBS yau_lo_re.[Link]~_from
_ _ f1~\es.+-wrile_dcitq_±o_:Hle.o ,_and-f e.r1'otm_variou'3 opera-hons ---
,__oo_±b'-LU.-_____ ~---------·-·
£.foL~etlmmin_g_aoj_or,eratLol)S__oo_a_fde....,_ -you. .
--~ ~e.d_±o_op_en_iU~±llo.n_ptovid as__±b e_bu i \l.--= in___} o E en_ CJ~ tll net -
ion_±o_ope.o_fLle.s__JLto.kEG_:l-_w_o_a~ume.nts_;__-fhe file, __ nctme _ _
r---~ OL f o.-lli )_illLc:UheJOo.d a:]Ee_moJ e_ [Link] i (')3 ih e. f\1'1 t%e.,
- - -9 -open in_g _JM_ _ {i I e...,J> 11di _ _gs___ve:i_c\ i ~ ' U,) HtiQ3 ' or Q [Link] i ~
-----•··-c\a-k :_Aftt.Y _jOLL::tlrt!\SL_WOJ k'1~ .w'ith a. 41le,' it's essenb a.\ -
_______ tQ __ clos e. _ it ___ t16irJ.3 _the __ ~\ose.i) __ rt:e-thod. tc ~e:1.-se.. -4he ~km
_ __ .. teaou~ces ossotia.-te.d W\~ +he t\e · _ _
--------.. He~e·s _dh ~;Qmr~--oF -opehin-3 and clcisi03 u -file. foy -[Link]~:
-------~- ---- - ~ ._==-======~=======+=====:;:::
____ .. ___ File _= oren ( ''. exqmrle-txt '~ ,''y '
1
# open ➔ h~ fi'/e in rea mo e.,
--------~.:: __ -fi\~. -d-o~;cf-~;1~-~ +h e fd~ - --
Cop~r~hletj bj Cociel~ithOn-i'ou_s-Ccrn
·I h
ii \H~ R1·,1,li I 111 tJl1, I l.111 I I Yl•j kid l i IM :
jl
l: , Pg !hon provide..:i wrious [Link] o ·lo rectd and
:i un1le. do la ·lo -lex! ·frklS • 1-or rradin~ , ·lhe.. mo Gl common~y
'i us~d tnc.\hod kl I [Link] () ', which Y1 cccJ~ -I he en·hr~ ,
1: con~tn·ls o~ f1'lc. o...s a t.S-!-ring, YoLI con aloo Ll~~ 'readlineD
!'. ·le t~a.d on e \ine. a~ a ·lime. or ' rcQ.d/rne~ ()' ·Lo [Link] all
'I \inea and relurn elhem as a li-c~ ·
:\ 1 70 wrik dcd a ·Lo o. -file, you can [Link]. -Iha' wriLe.O'
.1 rne.~hoq ·
!! e>i-~rnplc ~
,1
. ·' In addition to -l<?.X l· -r,\es, p~\hch a\so alloU>S /OU..
. ,: 10 woYk wi+h binQ~~ -n\es I ~uch Q\S 1'mq_9ts I au_d1·0 riles >
:, ot a~ o-1-her non-·lext {ile.:i • l3incnq file~ [Link] tauJ
1, daio. 1ho.~ \'~ no-l ~[Link] -re.~de\6\C: . \o re.a.J oY wtiLe
., bioarj -1-'i\e.-s I yol).. 1w.e.d ·Lo oren ·lhe.m in birn:1,1 mo~e..
l___.-==ft== --
..----tr--:-------~-----------------
--tt--srec:jt~i11_9._' Yb _' for_ ~Q.d~ -or ~.wb ~_-for U)tJ'tinj ~------~
I ..-
---·-~----IL [Link]~Ji9J'Ltlqnd I 1n9cJ1;dil1; or et ctf ions __________ _
-- ir Wh~ILUklrb~ _wifhii'b ,.+h e~-q~ P~~ibih'~i~.: ~
___ :_of-errors. , ~uch_a15 _-fl I [Link]-L.:f'oun d ,.term iss ion d eh i ed , or d isk'.s -
. fltl)_. Pjthon ___ excep±fon_b_andliflS _me.cban,\srr, __ allow~ jo~-to __
_
1
handJe._sllch_el'rl\15 _ _gta.c£bul~ · _ ___ ----·
,---,.---~o_u_ca n_u_s_~ e,__j-~-=-eX-_cepl ::.. fi·nctl~ _, block-~
--------~o_co.+.cL<[Link] Le\:tef"-°n-s..:...ln.....::lh.e._lq1Se_o F-f LI e._.ope.¥at1ons1
·-----;-1--l::s___Q_::p.1iL rmd:i.c:.e._--!o~tai ~ L _fi'Je,_opetq~'o ns . i n,s i ~ e.. CL
-----~~~[Link] n d le th p:tl.Q.hs_m_-!:he._' exc~block ·
__ lE_LJ(na.J~_'.__hl~~,lJs_us_~_o_ensLIJi:_trlCtt_ib e._f1' I e _ I :S_ rrore~ -
____ clos.e..cl.1-ae.b_if_an_e~cep±i.QtLo_ccuJ'5 · --·· ....
1----------------------------
__ E_'Xct_m_r-,e'. _____ ---·
-- ··-;::::==;:::::================~
----~H -:----------.--------~-
----· --~File. =_opgnJ~qmrle:hl: Ii'
1' r'D----
-__ __ :tt=-J?erform_operq,hQns an +ne file __ __ -~--
-- _ ex-cept _ .ID E-rro r : __ _
-· - . prin~ ~ .An_ frror_Qcu1red~) ____ _
· :. _!in~t~t~~el) # E~~~~ -lh; file. 1S-dosed , eve; it r:1ri
__ . ______ [Link]·ho n_ OQllYS · ~
Co pyt~hled b~ Codel"liHlurioUs• Co rn
I'
/
:= ~]~o-~o~ect·:· orienied _:
:_:_ ~==era-... -,.r~ l-r\q·n-~:(00P)~-= .1 ,--. ~u-u1u.u I a __
-· -·, J:__ ___ - -
[Link] Inhudu@;oo jp O.OJJ_ib_l;hlih;- · - ·
·I
I - A_c\aas___is_ct_b\uerJ_!n:Loc__~e,rr,plctte_-for_cxe.a_~~-
r------ __._,~C,b_Jl_def 1:n.e.s_±be_p-rop_Qdf ~ (a-ttd b utcB )_a nd_behav iors ____ _
oo)_±bo}_o~·ects_ cf_t-110.t_dqoo_ wil\_~ov~a~ ·ed
r----......-· ..L...·s,.,'--'-A-Ja n [Link]:.Lllf_i:\qs.s_· -------------..!
- ~-¼---___,__\.Q~s Ca · ~-------------1-
·--,-,.--t----"le.E in.iW_selE , brQnd_JnQdet)_: ____ _
Co~ r,l9hkd bJ CodeW i-lh Curi ou_s, Corn
___ . ____ _.n ~4tt10JL_Q_c_ondn1ct0L ia o-0Re.~1~f-~eih~d--1------_±bd_i:s_au.ioJna±irn \
Ly __ co.\\ e..d_wh [Link]) _o ~ ~ tt-is [Link]-e.J . _____ _LLI~S-llS e.d__n)_f_oi±1E:J_L~Libe_
0~€.c±~s - ~itfiblJ..bs • Jn~ ________ conshud-ot-_me1bod_ Ls_norne.ci_ ' __ in'rt __ ()' · \
A_ deistructor_is_ another_ ~~e_do.\ methoq --~~-~ ~H,ctt _1:s _ [Link] wheh _oh o~·~J
i's ~ ~olA+ -t:o be
. [Link],d:_ ot -_3C1rb~~ Clll\e.c~ · \!\ \~-'than. the. ddl\lc:lar ___ tnet'n act_ l\3 __
named _ ~ _ de\ __ 0 .
16l• ~-- \nheti-bnce., CAnd Tul~mox F'7iem :
-•- - · --· \n\ieri~nce,_io o. [Link]-sm in oo~ +ha.t
o.\\ow>S Q c\.a.s-s {o 1ntlenl:-rior,t-lie.s ctn~ 1Y1et\io~ furn _ OJ)o-thex c:bss• me. [Link] -
th0-t i~ ihheril:e.d from is [Link]
i s4re1cbss or rl'[Link] dttas I cmd 4he closs ·lhal: inherib
!
1
is ca\led 1he subclass or child cle1cs. In P~t~hon, o m1bcl~s:,
!· con override or ex-lend -/he. -funcl10ncdi½ er -\he. suEe rc/ctss
:! Po~roorph1'srn is -the. obili{j o"f qn o~ecf -lo
'.: {ale Qt) rn,a\,J forms, It allow-s o~eds of diFtetent c)q155es
ti to be +rea.+af as O~ecb or a common -supetclciss'
~_Io · <> E ncr1 psu h lion _g nd Jhl a I lid Ing_
--
I . - -- -
l . Encqpsul~+ion is the bL1ndlin9 oF d~~°' ( attributes)
~1 .and meA-hocis ( [Link]'on-s) with'in o. clqss ·1t proviqe-s. a. UJJ.j
:1 -lo O~Qnhce code ond qo.,tQ into lo31co.l uoik , · promotl~ ~e,
.. [Link]~°'[Link]~ qnd t'€U6'Qbi li!j · Ix:1.t·C\ hid i~ ts q [Link]~1c ospeJ
!I oF enmpsuloJion whe1-e. [Link] 0Jty1buk~ q~e. Kept pHv °'k)
1
1j te~~·c~~ . ditec~ .occe&S from ou~1'de.. fhe_ da~ -in,s f'romo~
:
1
-~ mformo.t1on hid IY)j [Link] d~t<A 111+~ nt~ ·
" Exqmr\e: _
ls===---==== == ====== =========r I c\Qss Ba.n kAccolln _'.
deF _Jnit __ L oel F, ace-no):
sel~·--acc_no ~ oa:_ no
QeF 3e~-acc_no(selt'):
retutn .sel~ . __ acc_no
_ ~ a~count = BanKA<roLint (''l3456 '~
, print( account. 3et_ occ_no (~
rr\n-\:( account. --Qet-no)
6i ~=tr==-- --
11 - -----· ------
~ o~[Link]~enid in3 a n_J OvedoQ.d ill§_ -------
---- , ,l".le:lhad_overridi~ _occurs_Wheo a _subclass -pr;vide.s -
_.-----1±s_own_1.mp\emenk~·on__oF _a_me+hod ioheriled_from _-{-he.
~~ [Link].J:') e\-li oLo_veJ\o a.d in_g j nvo \ve-s_d efi'n i!!_(J multi pie. _mel hods -
__ wdl±h e_oa m UlQ m e-1uLd i ITete tJL p,:i rdm Jrs _ w if hi n_ a ol q,g& - ---
- - ~ ~~1:t'.~m~;:.__:__~ _____ _____ _
---::_---'~b_(selfl_:_! ________ _
--P-rint_(~cg [Link] _q rtiJ __
· clctss inheri-le a ~ha e,, ---
clqasf RectqJIB\e~~: _
--+-e Ql_gg_l&_eU~±b w1d+h): _____ _
i.-----;---1....,__,nl.j..U,·o±-+-('-=-' eq.:.!.!.::lc=uJd]j::'.l!\..J·-~ rec~rale. qreg :_,~jthl..width) _ ____
-
re_c ~fe -Rec.tan_gle(J ______ ____ _
recta-Oj}e • C1 rectC Lt ,5)
------------------- - -
·--·----------------
litttiJllli~==-··-· -=-._:_-__ - --
I 11 ·R &c:erHon bandl':!3 me.cb9nistn :
.--tt-~C~ . '.cn_-h\pBl_in...sep1qle._exc_ epl:.J::[Link] ,.yo~f-~=
1 e.~e_snec.1-_Lc_qc.froris_±o __ ~e_tctken_fot_ eQch-~ _F.e.-0 ---_
----t+-"-'-'-cep-uo . e_cr.der_oL-the_exceeLhlocks_ J'.:L Jm 10 r½ nt_
--~:i-o.J __ eru:a_u.~e._-fu_e._£td:_1J1cttchi~ __ exce.f b'on_ block ~ [Link] ·--
-------------------
_.-----+[ 11·.1. Q1sJom · &cep±io n.s --- - ------
I · 5 Error q;;J Ii 23 [Link] :
___ ]oc...,____._p_~thon,_-\hetLa[e_3e.\Lete1Le. ttox_ h and \i~ _&if~ i ~~ ~
-·· ____ 70L1_cdn_et11p-loJ-'· _____ _ __
- .. --1======;:====F== =============t
_____ S:trQ_~ie_s _ _ ______ ___ 1)€.[Link]'on __ _
··- -----------· - -
_ --· _ Lo_gg in_g _ __, ~use._o_Jo_ggi~ .frctmewatk 1 .[Link] 08 -\-he,
---·· ___ _ _ _ __ 103.9; ~ mod u e_ t'n ~j-\-'no n , ta re.c.o rd
[Link] \
d~rad ci.+i on
an [Link] eifoflS ·
• [Link] fallbctck mechan1:Sms or- d
al\irna.~ve pq+h& ro handle. erro~ ~n
ow ro rbm r e etll-\ion
Copg119nte 6~ CodeW ithCun
1
0ll~ Corn
sir a ie_g, e.s . ][Link]
Re\rj mechanism lrnrilemenl l~Tiic -1:o au-bma-limlli tetr!J
fa1 led opera ions· ..
!:tror rerdi~ Noti~ users, r udmioidrct+ors, -
or re\evctnt keholders about error-S - •
- --·-. .:thro49h. [Link]. channekl · .....
- --- - .
Gracef,\ _ _ Grqc+.l -l:etminct-l:ion. ensures d~ ----
lerm,nution _infe.9t1 ~ ---and avoicb_ leav i f23 [Link] rce--s -
. - - - --- in .an incosshskn+ __ sta.k. __ -- ----
------
·• - ----- - ---·-----------
-··--- -----
.. - --------- - -- --·---------------
I
,.
!
I
I
·1
----------------
(op~,,.ght-cd b~ CodeW, thC uri'ou.s I Corn
-r--9---r--~,-f r-,- r-~--r•-•- r - 1 I r
- 1Q: ·. id'lcthce.d Dgtct .Ofrucfutes
.
.----List Comrrehsion '. -
- --i----=-------:::r-------------
_--4Jlli..robrs = [1, g,3 ,lj, sJI----------_____ _
--+~[Link].L_h.UmheJ~ = [x_fu.UUa_nlAtnbe.t.s (t _2L'L·_ -<._--_2.] _
--j/J~ io.l{_e_v_en [Link])_:;9"_o~-lrM : [{Ll.f_] _ _____ - _
--+------· ·--------------
Dote:---
15
Exo \e.:
5
' II : 5Lf
....
O ot,i:
1
va\ue., 1 e: ~ u.~ in ikah)e.., forrn
15
Cop4y(q h (aj rn
----__ .,.
---
---t----l-l~~....A..;2_-?-~~!...!.....=i.!:~=----L!....l ~,:C..ll=-.::==-<--.._,_._~ . .i.-.:Fo=--
-~1• f---lc-'===r--:------J..!...l--L..LU..,,_._-==-i,t----f-!~~~---1.!.!...l.~~...u~~=ch,_w~e-~-
r ab -llie '5
r,
on
e en+ t
-~2•·--~-.._---r----------t-----1r----'"'~[Link]-,n-----;
-~--+----+-------;~ ~-~~-kc_k_. ~
E
3~
6
COP\lri~h+ e.W db{u~o LtS . Corn
----
- -- - - --E01--o~ e;~lion __ -______ _________ _ ____ -
---- ·--------==~ -&..::CD;;;...i.---
-\e
®
1)
25
.....
c oP u..,, ra tJ..<nl()_,,.lo tJ,·lhr .. "-:...._•. _,.,__ r.---
,'
·d' I '(O\
I
Ya
CoP.~riitb
Ii''"
t , , .. .,. ,
iihCUeioLt~ · Carr,
D1t11: _____ -
/~ --'f era.+JonUn__fji\ioo_:_ _________ -_--_-
_,
----·-
7:1==------------------- ---
25
0'l''
I•ff''
:n
......
Cop4nghiQ Co [Link].a. Com
I•
--
•I
Dole:--
:,\e, 1 : l)~~t---tn.e_t:tlli'Jjj__:__ ________ -
~--=----------------~ ~1.
Even-s =-
l'J )educe, :-
-
Do ti,· -
----------
-------
-----
---·I
:5
25
--+------------------------,
D,11 •
~~~~.i:;,__---;--------------.--------...._
' -- ,_
Oa t,!:
- ... - _e._..fi:le.s [Link] b~,si ~<uinus ..mod es-] i.l<.e ~J, --_ lUI.iie__~~ · }Ue_fu_lLQW ~
re__:lhe__de.6 iJs a}x:iuf _ qc< es.s -~ ~de ±<Lof ~Ue. - - ..
\~ - -~-,----------------~
J=====4========~=====r== ==F '
t-+-----,-.J.J,,.__l,~h.i___l_l...l.l«_jl.[Link].__llJ_J~~~_u.,~'--· _._._.e__ tio~-~ ..J--------
1~~~~~[Link]...:._.[Link]:,._.[Link];.,,_~L.'jt-de-fau1l-_ ,.:
-__j_-----+-..µ.u:._--11.!S~~,J__!:j:~~il__.[Link].,_~~~-i~ e_
5W
\D 1l)'1N
,, I
J---.-~-__,__~---,......----,...----..-..,.--.---.,----D-r--ar<? ....,.-----,-----:-·-~ -~- --
--------/ Jil~ -Qf ;(~~le.-hi" () / .J~-~l'e_r t< ~ - ,- ------------
-,:--rn nl: ( '' Iile:.. is Qj'@--""'-=e.J½,~'----------_
~tr-u.l .·
<c\qss - ' io .
'le is [Link]
· c os~J
(
·p p
wrth one at ±be. :fu\\oL access roe
(opLfriahJfcJCc pL,JJhCr17r7fl1e,~ ,(l\wi
Oot,,.
Dote: - - - ·
-----·
I f=?C:Q/)) le. 1:
---
- --
l
fl 11 •
I{•f
cl "~j i,1q !h C. Cltrr~h I t\l~il,1 ~ •J J, r~, / 0lf
. ,;
1lie, chd,rcJ mdhod 1:S . Used -1,o cha'('.)e -/he curren/ wo1k1j • ,. d,redoj -lo a -spe.,,J,e.d
d,[Link]~. · ·
llie. ~nlax -lti use. ·/he_ chdi1 CJ melhoJ 1~ 311,eh below·
~n~ax: --~-_-_-_-_--_ .
, chdit (" ne1.0-dirtck;j1 ---------~~-~
__ J2ililin3 J1,f'c/;11 ---
&•
~ __ llie 1m\Jo'r (J ~eJ-hcJ is _4se_J :lo de/;,/;__ -/h~ ,sF,i);c dire.c~~ ·• ~_.,lfie ~nto.x -lo. ..
tJ,Se. -/:he;_rmdi'r.CL_rne.[Link] .Is 3iv~11 belou.J1
-------------- ------ Sjnf ctX:
~ _Qi-irndif[di~c/;JH h_C!'!)-~-----
=--- f,amflc.
-----·-- --------·--- . i
=---~o: 1h; new -dire;JoJ _____ -_-_---- -~~ __ , Ot rtn~ill "ditec/o~ nctrr1e) _ _ __
= 1 l))i// temove +hu e,;J,·J_d1~a~g-;----~-~-=-:--
. ' (0~1J,}1:c,hi(J'rn,l,Jd11cn.~;~,o~ '~M
.-
csy. writer - Wri.k :lbe dctl-a :ta a C6tlle.,
..
J•
[J ,,,,
' " ' , ' , ' -,
15 · Re,5tile1r txrre..ss~ns
/~> I Jnlror UC 10n · CJ t('.< Ld~r-[x ~ e,.--:.~io-n -- -
' ' A, ~~ulc.1r ~ftBSSicn _ _is_-Cf _s~-1-nf-~[Link] ·..:i ic:
---hL9h~ sre.cial1~~ ~n-\Wh~t_we..can .Lise.. tQ __ fi'nd or. ma-kb.- i
--:/.- othet c~aracter.s or 3roups_ot __ chcJJctde.rs_Jn__.sho4-1 ~[Link]--~
~--exfress1on.s , Cl R~ex._, dtt_widejj_ulSe.~ Jn_:lbe_UNIX.u.>cv [J __ . ~
,., - - --~--- ------- --:=-.JmrJ 1+ 4he r~ .Modul
...--· :#-im r.o1+ina ~ ~..mD.d~~'-----------~ ----. + --.J ___ 1mfof Je., __ ---------------:-
1'# --- -- '
== llie,-re-m oduJe,_j~oy ves ::fulLsufF ~[Link] I expte.
___,... 5S Ions --or -P [Link] L-6±.j~~d.u_te.,_Jttis e.s 4ne_J:"€ .. _et(Qt __
_ _ _ex~e.r· on _wbe.n e>Jeit_ Q.~tx.01-_c1c®-s__w hJe, i mriem_en:lu~-~
__ _ USI r1j ct. ~LJ-1 Cl Y----.€)(rtt&SI . ............_ _________ -.-
~t
= ~:"1~la:ch~r;:;-rJ~r:[Link].\ cbqrade1,c ------ -,-
= _: :Dii _.: JLma.-1-ches__~...di_qr~r-s.~k...[Link] Ii n e,
__ .. _ __ chora..ckr __________ ~-,--
- _,. A _ CQtel-c Jl-.lS_used...:[Link].Jhe7Jktn...hc,rnJhe. &br+ _
--__ . __ o¼ _-lhL~~--(~tgrh_JJ1H_b)
-- $ no\Jqr.:.. ll makhes::\-be__en..d_~_-:!b_e._~_b-~futB__ihe. netil
---- __ _ _____ _.\ine.~harqcbl~s_wlt~------- -
- t __ Ask1 isk -\[Link] .zero m rni:,te._ocr.UJ Mees ,__Q,_pJl-ey_lL:.
-·-+ f lu.s ___ -:__J±__ 1:S _u\5~he.n..~w~n.l D..f ~t9 __ m~
- - _____ __le.q'5i_ __ O\l~----------·----
- ~. ~u.~-s~[Link] rnotk:: .LL..mddi~etQ..g'( __ on~_o_<:UL~ -~ - ~- -
----~ r-~rP · . . . . . . . . . . . . . . . . . .
co,.,lJ~1°cj h-1 Tc0r,. J ~,J ,, t h<(J.) 1nu8. r ("I fY7
o,,,!. --- --
~UAJ_~ ~.UU:!,J____i..u.J..U:~~~-L-:-=+,uJ~~~ -~ chamder_~
.
25
· ht [Link]~-i'cws·Ce171 (opLf)fo
D.:il'? - ----
/ --- ~--.-:---------~-----
-eomri le~ed :lo :!urn a lijLll~_qjkrn_io±o_a1:--°~e.d _ _:--
/ - of Cl t~u.lg1 e><rressian :lbcJ 'fYJllt be, usd.J?-a_fll,Ull:_
· / _ b~r of WO'f'-for mc,.4cbi~ pa:lferns 11'.L(uSk.j-'---
,,, , segrcb - ll: 10 us_ed to £ind -!be. :flh~ oautence ai a c~r:e.'L--.
rI's·.
-·
(
16 · Web Develor-menf -With P~thon
---
I G I In.\ r o,I ud I on -fo_We6-[Link]±.____ -
-.
~ - . :--Web develormenLilllLOlws creo..kj-web5rle.s_ a~d (l)eb -
_ arf \~~ns_:H1Q+ __ can._be-°la:~_seLo~r :!he. in.-kmeL __ Jhese_ - -
_____ _ a f\l1-cnl-i ~Uoro t1 e,
0
.s-6:l:iC-W ehsi...-ks_-b:i _CQJllf ill<,
> _d natni.L__LLILr~-3 + . ~~d 1 onc;k1 e.s-.
" jlhruu ~jJ°f.91 . ~o ~. ill~11!' ~y tU:Lde~rPL=.
_-1--',,-u..[Link]: ,mRl,c l 7 _rmdol2t!Lt n w de,~~~
eb Ftaooewodss and li~tiP8 avru15:hie.. for dmJ.or_gr,s·.!-' ----'-
~ ~=enh ~ Web develof mend: •
IS
Froo±-end :DeveloF-11'.lf.1]:l:
DOI' s : u ranas CU) IJJOJ~ li'ke reac+
kt.~d Vne .,Js are ofko used ±-o s&eam/,ne, fion-1--
-- [Link]°f~m ......... ~_.._.._· __________ _
......
If\ I I II
CoP:.tri:il. o CocAe..,-. ·t rtt,i',.,..t.5 -C, •
D ,1.,
p cal (Hrrg) IS ±he, [Link] ~~
b ,[Link]:&~-u.c~.J-\,L_n _-LJ;lQ±Q._mlffiD?[Link]:nllil.ll__!w.L~L-
UY...:~s~w~eJI