0% found this document useful (0 votes)
3 views114 pages

Python Handwritten Notes - Compressed

The document provides an overview of various operators in Python, including assignment, logical, bitwise, membership, and identity operators. It also explains data structures like lists and the use of control flow statements such as if-else and loops. Additionally, it discusses the concept of placeholders in code and their purpose in programming.

Uploaded by

Ben Kumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views114 pages

Python Handwritten Notes - Compressed

The document provides an overview of various operators in Python, including assignment, logical, bitwise, membership, and identity operators. It also explains data structures like lists and the use of control flow statements such as if-else and loops. Additionally, it discusses the concept of placeholders in code and their purpose in programming.

Uploaded by

Ben Kumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

classMAte

Date
Page

*Assignmen Operataxs
Assiqnment Operators are use ton assign vlues ta
yaniables They include
Equal to [E): Assign the value on he tigbt to the
yaiable an the a.
Campaundassiq1ment opeators(=,-s t ) perfom
he pecihied artbnmetic dh erations and assign he rEsult
to vahiable
* ogical opgakors
loaical operaars in puthan are used ta perfaxm loqica
OperaiasaS- on Boalean values
logica) AND(ane): Retams tue if both apetands are tue,
otheruuise false.
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
* Bitwise Qperasotg

Brhuise aperatats perfaum operaians on indivslual bits af


binars humbeLs

Bi+uise AND):ferfoums a bituwise AND Qpetations on the


binany tepnsenhaians of Hhe aperands
Copyrighted by CodelithCuvious ·Com
classmate
Date
Page

- Bikuise. OR): Ferfonms a bituise OR aperation on the


binaus rep ESentations of the bperands
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
Right shie(>) shift the bit of the left operang to the
vight hy the numba ag positions dpecihied by th

*Mebership Opctatars
Membesshbip aperaors ane used to dest whether a alue is
a member d a sequence
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)
entity Opetators
dentits Opetrators ahe uced tn campare the. identity o twa
ohjecks.
Is Retuns Trie if bath operands refer to the same
obiec
lss not Returns True i both apelcnds da do not refass to
chjed
the same abject
Copyrigbte by Codewith urious -Com
classmate
Date
Page

4List,Dietlonar set
ahdl Igpe onversion
Lt List

In Puthan a list isa veksatile data stucure


Hhat allous you fo ore and organixe. mulliple items in a
Lsingle variable. Lishs ake deined bybs endasind aa sequence of
eements uithin scudie brackets I and Geprating' Hhem
with commas.
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 alistby 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 numbers1,.3,44
Copy righledbq Codewilh Cuvtous-Com
c./,[Link].
Date _ _
Page '

,,,- - - - t t - - - -- -- - - - -- - ~ -- - -- - -- - -
CopJ r~'nte ~ CodewiihCLrr10LIS Con1 I
/ - -- tt-- - - -- - - - - - -- - - ---, ----= -~ - --
Cop~ ri3ht~~ b_g CodeWi-lhC~r ious$ 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 dec1sionlS .
e,
F Bloc.k

SK)p

be exe ihon i-s true,

Cop~ riq nleJ b~ CodeWithCurious Corn


j
-fg
"

q
I qnatber b\ ads 1

~ ress1·on if Block EX te'5si'on / else Block


~
I•
,_,,
Q
c./[Link].
Oate
Page _
c
at
- I

Floul~htt ,i
- I

- I
-
I ffiar.\- )
-
... I

/~ Hl\.~e., I
\ 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>iess ion/


i~ b\ock Else-iF bloc.k Else - W block El-s~ block

~L .L
I J BtoP ~,

S~ntax:
I'
-
if rnndi-hon1 :
. #- code -to be exewk.J i candi-lJonl is 1m~
✓- e\if conditioni:
,, =It coed e -1:o be ~~J ,1 co ndit, 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"

_,,,,,.-- - t i- - - - - - - - - - - - - - -- - -- - --
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+

:=--.!Lil6.. e.~s;U~LQ..tnLe_:r±:u~~;~~!LL:ruO..cb:___e_ck_.s _i\_ 4h_e_ rn_co_m_e _ \_,<s_8_ff_ '_ _ct_ _


~ - - U - - - - - - -- - - - ~ - --:--~---- -
Cop~t~h-led ~ CodeWi lhCLtr1ous • Com
-- -- -
----- --
___l=--_-g-::;:_-l:oop-s_ __ --
I - -
- -I i - - - - - - - - - - - - - - -- - - -
. .- !
1
. r~+ho1LfJOYides__sev_er_C1l½pe.s_oLLoo ps--l:o- cq./er-
---·-----+lo. d1 FFere~b_ loop.i_nj - nee:ds_:_Jfiese_/oors_ offer_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±: repm enls~ oL3toup_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~- iLlb~co n_di±LQ~is ___eval uct+e.d_ ct6_ +i ue · -
_ ___._fL_ for_loor-~--IEJ~ loQp_j_~_ us.eclb__ilerale._oveLa_sequence. -oF _
___ _ _ I eIem 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.o ~au_ctbLe_ ao_°-e_xe.cU~_a_ code_ block _1
___i_:Fat__ectch_Jk1n_1n_±b e._~~u_ e.n_c - __ _
f
- ~-- Ne~ted loo __;__i~[Link] o.l to_ul\5_ ll(Lj:O_ bqve...J o°f,s___j VJsid e., ofher_
_ _ _ 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. ~ernen t
.. ,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 r~:1ram • at
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;----pl~celxiLdeLfoutnf½J -fund10n&_oulassas . I+ all~ws 1ou
1

---~[Link] tte_valiclrode._-1;M hoilue.e~mmed iJe Imr \em 1chl:-


- --il QtlCD ·
I'
etnon~qle_-lhe._Use_o~_tbe_P~ - ~ktcmerJ_: __
n ():
L -- - + - -- . C\_6_ - \qceholder -fur_f~re_codL Ln1rlelY1en-k-t1 OY) -
,j I .

q - - - 1-
. - - - -.,.tt----+-=-- [Link] :fof coro k_ruJ_c_9J ~- - - _ - -
________c~ qss M c 'L-ss
-""-'= -:- - -- - - - , - . . . . . - - - -- - - - -
ss ;mpl e.-men .fa1·an._ _ __
f ~
~ - - - t l t - - - - i - - - - = - ' - " ' ' - = - /- J--f-'~ = - i = . . . = ~::....,_ a.

- : -----------------...;
-~-~LJJ/ii_luQQf :---

.\e
_.__._----""wbile
--___..__ _ _ __J~, loop in P3:thon re _en:t_ed~ exe.c.u±e.s___
1
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:__id e_~te.ss10n__oLconditi0,;_-fhctLis __ _ .
'---- __ e,alua~Ed_before._eo.cb_i~ler_q_bJlJL...J F ibe_coo:li-h·~o_fs _-:-rJE. J __

________::fhe.._code _bJou"-_i-o _execukd- - - - - -- -


1
-- _ IL+h ~--coodi-\: \Cn_js._:fufse.--,:lhe_lo op- 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 :_____ _ _ _ __ __

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 pel~rm a. Get
'fU. -!:o or
actions ~r ~ch itErn )I')
itle. ~e_t.l ence.. . TRe. locr \'OTi<l.b le, -l-~\es -the. value. e::tci) 01
ihrn in -H1e &9L\el1ce · one. bj one , until\ -lne ..se.1uEnce is
c~p ti.:J--~2l 2d [,:.\~\',~:~::,~·:"'~ •:.:n'
------ --- - ---
_ -[Link].hl_._
- - H- - -- : - - - -- - ---------- - ·- - - - - ----

. --tl-+---LfoLi.tem_ln_ ~equencc:::.,___ _ _ _ _ _ _ __ _,
-_ _ _--+l - - - ' -' code.. blo_c~k J - - - - -- - - - - -

I Hlli.Jb_e._jtem rept e£etl:bs__J1b LJ OOf _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] L~ rn In 46 e_ s e9uen ce_ ·
• 'X \e1 : H-era +e ov ~ l.___ _ _ _ _ __ _ _---:

~ - . '.,. 1-fl_,___,_t~ppl e. '', ' banana.'' , 11 chen;g_''=1--------r--- ----,


1

-- . . nw,·..L..,,-L....'.....:- - - - - -- - - - - ,
·n±-(-fruit,J - - - - - - -- - - - - - r - - -

lL !

,,
Ii

- - - - - - - - - --

ii
Coplpiqh{ed b~ coaewd.-hC~rio~s I (orn
.9g 1_
--~ £xc:1m le.Z ·. lletale _u.si ~ 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-_ nrrk_ea.ch_n_vmbex_. _
1
--r
S9

.- -, behiieeruoc\i-~;-lue in _+h ; -_~~juttice., _- _

_::=l,1:mro FleLllera.k-Ovei_q _ Yd~ e { humb~


------rtF=;;:==== ==:::;::== ========== --
____,l_foLLJLIQQg e_(s_)/ __
: _ _ _ __ _ ---
__, _ Prinl.('-"""r_
i)_ __ _ _ _ __
r ,
1

-----,J-__:_===~=======================----- ----
1

-~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.lO1~ :

r.--------....i-,--p_rio± (i)_____ _
r- -.Lout T,( ~.- - - - - - - - - - - - - - - - . - - . !
'1

---· ('op1.(dqhte. LtYIOLlo • Corn


n_4hi-s _exornp\.e,Jh; _r~~~ (1, 1o ,aj "tuncfion _gener?-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. number 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~0- [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 fle'. _-

_ _ ·-· for i in raQ_g~ ( 1, 6 ·.


. _ fo1 j in rq~e Cii6) :
*
pb"\nt (i J) end& " '~
rint0
1
Cop4r,9hteJ bj Cod~Wi'lhCun'ous,C'orn
~-------
.----;;F==:========= ==========r
----~·,. 1 ~ ~ - 5_ _ _ _ _ _ _ __ _ _ _ _ _
__ _
1 6 g /o
3 _6_9_:_
--~r-- \1-=15_ _ _ __ _ _ _ __ _ _ _ __
, '1 9 I2. I 6 .zo

II

"

[opu r icihted b4 CodeWithCtnious -Corn


---- -
--- ---

- - ~ -- - -- - - - - -- - - - - -----------

~ :i 7· Ll,g:lhutL~S~i~L~D.8b--- - - - -- - - -- -·- --
!

- - -- - ... . - - - - - - - - - -·
(op~ riqbled ~ CotjeN ithC~r10Lls •Corn
II

; &trl ~ l\ello I //= siri.9/0 7110/e,3


I
0

; eh..'l_ = I Wo r)<l ' -:-//· JJocihl Q. 711() LPS


\Sir.a .. i1 "" ' ·1ftf Ie 7r.k'J l e.s
,-.n_1\·l11r on I~ [Link]"LL I l~n.:JU.q:1e., , ,, "~tf
:I
! 1
,1 frint (ti r I)
;I ein t (IS/ r-')
i\ r1nt (& ~~
:- - -- - - - - - - -- - - - - - - - '
!i duJ-hu.~ :
:j --.! f' -

,, Hello
; )1'\ot \tj
11 f.~ InoY) is r,ower/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 [Link] valid fo1 [Link].~ filii0_315 in fl tho n •

T7·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 L1.0 ,

I
I'
I
I

Copq1 iqhl c,c\ hq CodeWilhCu11btts•Com


---
---- --
----
-==-~exa 11
air le_,__eacb_lelkuif_±be_clr_j129 _ ~Ell{) ". il'l Q6S~~~[
d~cl.in3_iron1-o~__]E.e.J.e.H·_e,L1-LJs_QL1 nd ex_o'.__ E - J.S
__ _ __ao_ki_J n_
__ __oLi.odex j, ''I'' 1s_a.Uod_ex 2 o..n.cleo__on_· Understand 1!l.9 - -
- - Stl.L~_incLe.tin9--1:S_imP-oi±qn_~_be.o.e0tus_e.,_it_Qlb lJ-}$ _yo LL-lo_ [Link]:ess -
___ _q [Link].o ni filla:le....llf kif1Jc._Ch a [Link].s___ 1;,,i-l-h in d. ,s-l-r i' ~ · - -
- -- -
-\be \Sh:iQB
7·Lj ][Link] _____ - - - - -.
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._del_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----~ .= '' - - - - - - - - - - - - - t - -
= ,, WOL.Ld_
eouH- = sh + cir 2.

--~Uepe±i:bOD C*): lfi e_1Ere-h [Link],fmtln 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 ~ c t ; ; 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 cce:)
[Link]£t~ _ct :shi-'2'3 ~ +heir f°~Ji ian ( Mdvr ·
indua C\
Q
35
--

- - -
,----;:bqmFle_~ _ _ __ _ _ _
-= F_=s==;:_=:J:_-==:_"~H::::;:

~ --...r\n\:Jclci[o__]) =ft o~~ !


11 =
_~\\=0;=

H=-
= == = = = = = = = = l

_ _.,.~[Link] ) _1.___ _ * 0111¥~~_


-- ---...----:- ~----=--- - - - - - - - - - - - ; -·
_ ~ S~dn;l ( [ :J) ! ]li_~li__ci~_opera{oLis _u-[Link] to ex~c~ o.
__ _ subdrinj--1i:om_Q_1sh-in..3_bj - -spe.ctbiin_g Q ra ~ e. ind Ice.s ' or
Fxqrnl)\ '.

- -~CLL..L--'~~ ,_wom~''-- - - ~ - - - - - --
--t--~[Link]:t_(std [6 ~ 11]) =#-ou±f Ltt : W~rltjl - - - - -

. -----
__ E--xqmple·-_ _ _ _ _ _ _ _ __

6 1 = '' Hello__ Worl ' __


rim- (' v-Jorld ~---in_~td)
1
-[Link]: Tn.t~
rint ('' p~thon ''
not in sh!)-=#= output- ~ Tru ~
rint (" print~ '"' d-ci)
1
# 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 -·-------·---- - . . . - - -. -

ot
_
_-·..+
- ': ----- - ----- _______ Fqnd-ion()

1
in Pjihon are [Link] reu6e1-b_l~
code__+fttt r~-to1rn . Q -[Link] ti"c _-\a,sk,lf,~ bel f. in 0~ cin,xl~
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
1

___ i: A_funckon i-s_d£tined__u~in..5 _-}\-)e_ def-_k~wor .1

_ --.:.!.. . . ,o~ lloweclb11__:lhEc._Jt1nclio ILl'lQ_m cand rrc:m-lh e.-s i.s . AfllJ . re4ui re.J
- I I ar~grnml'k.~qte_ -6?-➔e.J_w Lt\:lm_-1:b e._pct rq rrt\i 63 :-s j
----tt---' r --
: lE e._b_o_clj_ oJ_-lh e_--fu n_d1 ·o nJa._in~ etltf.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\~ u.\-b · ____ f
• lfi~es JtLfunc:tLor:U_

r~=
lne,se _Cl~-- ~ efh~J -fun~tion~ thQ-1-_q ;,~pro-ad~J
---·~ Built-=: i n_f<lnchci-n~ :_
_ , b3 ~on_ Jli~__ate_t1'.[Link]~ _ovaibble. ~out&uoithu~~l,!_~
, Q~-'[Link]±[Link] d~~ BLt1.l±.-=_1 o.-fun c:-B ons_caver_a_ __w1de_~_rctt~j Lal
---,-.-
-- i £ m&ioooli:k03_c_Such_a,s__rrLo LQ,_ Ien iLra119 e.JL1-10 ,Ll+LLQnd_:§ e._J ~ r
_ ___ __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__cte.aleL~e.,_


C'oe:J t1~11te.J b_'j Cod~w i-lhilincll3 . Cbm
' I

48 .
I
.J, - - - -- - - --

---- :: ~e -pro~ramr nedo rrfuy~ -sf


~it,c -¼sk~-
ba~ ;n-4h,e
rr03ram
- - - :;_:,S_ .r~uir emen-\s · User-. det1'ne.d funcli'ons heir _In .break,~
douJn
- - ;; o. f1°[Link] ~ inlo ,smaller, rriadu lQr o~erk , ~ak i~ -fhe_ coJe
corrr
____ _ .Ltnore. 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 _-\h e,_-funcl-10 0 .
--·;-'T-re9u1red-_ __ ___ ___ __ - ·- •-·-•----- ____ _ ____ _

:.--- --·· - -------------- - --- ---- -- -·-· -

:.....----'·~U-s uhe._deLb~ W_OJ_d-=llil\o wed_bj_+h_e,_f unc~· on _l) am~ to .define, .


;.....-----,--,::thuun_chan · For ex.qm1le.-)_d_e f 8recl()_' • - · -- -- --- -- --
:..-- -~ ~.:.l\dd_ra1enlheeJ?s._a ffr_±b e_ftm_ckoo_n.ame __lo ...def't'ne. __a ~ -
'-----1rqtam.e.:\-er,S_jb_e_f_unct10.o_m_q~_ a_ccef-L:. ro ple.,.,.defj re~ [na~:
.F-0 LE?XO

~ - -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_icLi he,_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 -=/FouJ-rul- : He.I lo , joh~
- --.---
1- - - - ~ - - - - - - - - - - - - - - -
71 1
(' • t ' •

I
I

~ ;I - --- - -- ---- - - -- ~

. ·I

:=· .]/-_
y- ii
- -.F-un-c+-,o-h_-o-al_lt' _o_g_ ___-__ -..
_. ~-
g-
I

~--1 uncl-i'Qri_cc,.l\
_f ln.9 j n- ~~ n Is -lhe roc ess
- ~ _f~n_ctlQ_fi_bj_llSLQ9Jts __oome -followe.d bj pa
execut i '!'.I a def;n
rq n+he1S~ · When d .
ct ed
~ [Link] _r.alled, -the. code. in5ide -lhe. -fun di ms code block 1.s

-~.
_ex-[Link]-· - - --- --- -- --
1

__- .a-aU- a---:[Link]-cH-..o-□>- fo


:!_T_oo_- 11.o_LU_-)he,se,
- _- ~f6 :
I
- i1: _ 1,,h ik_the_ fun dion_c u1L bj_Usin_g -the -Func-h~~ name -fo llowe.d
~
__ _
=- -- -'~fQtan.-[Link] examfle ,_greet_()_. __
_ org um [Link] or arame-ter.s , fct&S
:.-- .... -
_; ·
?~ ltle ._fu n.c b:o o__ acc e~- a~ 1
,.____,!-=1:b_ e_m _in std .d~ mt h ffiBS_ · tor_ examp\e , _:l recl: ( ''John)

, fxgmpl :
.>-:_ _ _ _ _ _ _ _ - -- ·-- -
:.._ __- -l--- -'"........._8L€d:J.n_Qffie~
_
_ _ _ _ _ not( "Hello, l1 tname._+~ ''~!-'' - - - ·----- _
_Brre±-Oo.b~) =#=:ou±pd-: '' Hello_,Ioh n1."
- ---n_..:thi:s_ exomp le,Jhe -fun c.-hcn 3reet IS defi•ned
:- - - - - - -
,_ __JJJi±b_one_r~ ram ~- ~ame_:__1n ~-function i:s _
-+hen ca lled. with ihe.
- - - ar3ument_ John lns,de._-the rarr1n-fhes~- lr,1s results ,n ihe,
~ e
:-----i• fund-i'on-1eirzg execu-kd qnd 1rin-h~ -the._gree~.Qg mess
=- -- 1-"Hello, John l :__

--- -... ; 8·· z- _RettHO Si~km~rrl-


._ I
,shkmen~ in ~-\hon iG lised to -srecir\ -the.
-- 1 -i --Jll~rn func-hon ~ho (,lld [Link]- It allows o. ftlnc+i'on 10
-- -- l_vo.\ue_1hoJ__ o
--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__be._~ore,_ ve rso.-H \~


~_ 1:0 __ _
_ Q)JnmJ!nlaJ.c__ resLL\h__ oLdctk ba.c\_
t-----___,~ _ ro-'ltdi03_a_w_~_ta
1 CO_~ ·
_ ----'c~\\\Dj_ _____

--= ~---8.'_1:LScoFe-~ )/qriob\eG __ ______ __ _ _ _ _.


- - - - - - - - - - - - - - - -- -- --

-·••-· _ _Jfe _\.3cope- 0Lo.._ve1riable., __Ln. f~+hon refer6 tQ -!:he. __ .


_ t ~(on_ 0 F_Q _ ftoj [Link] uJ here :!he, _Vd nab le._fa rero__g _ni;.:J CAO J CO.I) .
_____ oe_ct.[Link].d ·_ lt .de-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 · VqrLr.tliJes__le~J~nside. ;iunc~o!L hqve_ ~[Link] -
CALS1Dpe, :
,_-~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.11on _of_-lhe.,

E__
___-.£-unction cn\[Link].iio_n_comp\ e{e,~ _&ec.LL4io r1, +he locct( _
__.__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 Ie,
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_fu.nct(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 __bee.ca.use_,-h_is_no+_in -tne._sco e. - _ _
1

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_wt1itD_B_ dc,ih_1o_fil&s '.__ In_ p~-thon,-_-
. f, le-YLulLows_yoLL±o_ w_a1Lw i±b_ e.<lern aLfrIes_ slurecL an ~
_ _ _,_youL caro.p-ukr 's d1:sh.:_lLei1_gblBS yau_lo_ [Link]~_from
_ _ f1~\es.+-wrile_dcitq_±o_:Hle.o ,_and- fe.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__±be_bu i \l.--= in___}oEen_CJ~tll net -
ion_±o_ope.o_fLle.s__JLto.kEG_:l-_w_o_a~ume.nts_;_ _-fhe file,__ nctme _ _
r - - -~ OLf o.-lli)_illLc:[Link]:]Ee_m oJ e_sre.cij i (')3 ih e. f\1'1 t%e.,
- - -9- open in_g _JM__{i Ie...,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.\ -
__ t16irJ.3 _the __~\ose.i) __rt:e-thod . tc ~e:1.-se.. -4he ~km
_______ tQ__clos e. _it_
_ __ .. 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' # open ➔ h~ fi'/e in rea mo
1
e.,

-------- ~.: _ -fi\~ .-d-o~;cf-~ ;1~-~+he fd~ - --

Cop~r~hletj bj Cociel~ithOn-i'ou_s-Ccrn
·I
h
i \H~ R1·,1,li I111 I I
tJl1, l.111 IYl•j kid liIM :
jl
l: , Pg !hon provide..:i wrious [Link] ·lo rectd and
:i un1le. do la ·lo -lex! ·frklS • 1-or rradin~ , ·lh e.. moGl common~y
'i us~d tnc.\hod kl [Link] () ', which Y1cccJ~ -Ihe en·hr~
I
,
1: con~tn·ls o~ f1'lc. o.. s a t.S-!-ring, YoLI con aloo Ll~~ 'readlineD
!'. ·le t~a.d one \ine. a~ a ·lime. or ' rcQ.d/rne~ () ' ·Lo [Link] all
'I \in ea and relurn elhem as a li-c~·
:\ 70 wrik dcda ·Lo o. -file, you can [Link]. -Iha' wriLe.O'
1
.1 rne.~hoq ·
!! e>i-~rnplc~

,1

. ·' In addition to -l<?.Xl· -r,\es, p~\hch a\so alloU>S /OU..


. ,: 10 woYk wi+h binQ~~ -n\es ~uch Q\S 1'mq_9ts au_d1·0 riles >
I I

:, 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___.-==f t== - -

. . - - - - t r - - : - - - - -- - ~ - - - --- -- - - - - - - - - -
' Yb_' for_
- -tt--srec:jt~i11_9. _ ~Q.d~ -
or ~.wb ~_-for U)tJ'tinj ~-- ----~
..- I

---·-~-- -IL [Link]~Ji9J'Ltlqnd I1n9cJ1;dil1; or et ctfions____ ____ ___


--___ ir Wh~ILUklrb~ _wifhii'b ,.+he~-q~ P~~ibih'~i~.: ~
:_of- errors. ,~uch_a15 _-fl [Link]-L.:f'oun d,.t erm iss d ed ,or disk'.s -
ion eh i
andliflS _me.cban,\srr,__ allow~
. fltl)_. Pjthon___excep±fon_b_ jo~-to __
_
1
handJe._sllch_el'rl\15__gta.c£bul~ · _ ___ ----·
,---, .---~o_u_ca n_u_s_~ e,__j-~-=-eX-_cepl ::.. fi·nctl~ ,_ block -~-
F-f
--------~o_co.+.cL<[Link] Le\:tef"-°n-s..:. . ln.....::lh.e._lq1Se_o LI e._.ope.¥at1ons1
·-----;-1--l::s___Q_::p.1iLrmd:i.c:.e._--!o~tai ~ L _fi'Je,_opetq~'ons . in,s i~ e.. CL
-----~ ~~Jor [Link].J ia ndle th p:tl.Q.hs_m_-!:he._' exc~block ·
_ _lE_LJ(na.J~_'.__hl~~,l Js_us_~ _o_ensLIJi:_trlCtt_ib e._f1'Ie _I:S_ rrore~ -
____clos.e..cl.1-a e.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
[Link]·ho n_
) # E~~~~ -lh;
OQllYS · ~
file. 1S- dosed , eve; it r:1ri

Copyt ~hled b~ Codel"liHlurioUs•Corn


I'
/

o-~o~ect·:· orienied
:= ~]~ _:
:_:_ ~== era-. . n
-,.r~ l-r\q·
. ,- - . ~u-u1u.u I a__
-~:(00P)~-=
-·1-·, 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_def1:n.e.s_±be_ p-rop_Qdf~ (a-ttd butcB)_a nd_behav iors_____


oo)_±bo}_o~·ects_ cf_t-110.t_dqoo_wil\_ ~ov ~a~·ed-
r----. .....-·..L...·s,.,'--'-A-Jan [Link]:.Lllf_i:\qs.s_·
-------------..!

- · - - -- - - - - - - - - -1-
~-¼ ---___,__\.Q~s Ca ~
·--, -,.- -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 .
______LL I~S-ll S 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_d o.\ 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~n ce,_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 dttas I cmd 4he closs ·lhal: inherib
rl'[Link]
! is ca\led 1he subclass or child cle1cs . In P~t~hon, o m1bcl~s:,
!· con override or ex-lend -/he. -funcl10ncdi½
1
er
-\he. suEerc/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 · <> Encr1 psuh lion _g nd Jhl a Ilid Ing_
I . - -- -
l. Encqpsul~+ion is the bL1ndlin9 oF d~~°' (attributes)
~ .and meA-hocis ([Link]'on-s) with'in o. clqss ·1 t proviqe-s. a. UJJ.j
1
:1 -lo O~Qnhce code ond qo.,tQ into lo31co.l uoik , ·promotl~ ~e,
ts
. [Link]~°'[Link]~ qnd t'€U6'Qbi li!j ·Ix:1.t·C\ hid i~ 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~

: -~ mformo.t1on hid IY)j [Link] d~t<A 111+~ nt~ ·


1
" Exqmr\e : _
ls===---= ==== ========== ==== ==r
I c\Qss Ba.n kAccolln _'.
deF _Jnit __Loel F, ace-no):
sel~·-- acc_no ~ oa:_no
QeF 3e~- acc_no(selt'):
retutn .sel~ .__ acc_no

_~ a~count = BanKA<roLint (''l34 56 '~

, print( account. 3et_occ_no (~

rr\n-\:( account .-- Qet-no)


6i ==-- --
~=tr
- - - - - -· - - - - - -
11

~ o~[Link] o~enid in3 an_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_defi'n i!!_(J multi pie. _mel hods -
__ wdl±he_oa mUlQme-1uLdiITete tJLp,:i rdm J rs _wifhi n_ a olq,g& - - --
- - ~ ~~1:t'.~m~;:.__:__~_ _ _ _ __ _ _ _ __

-' (selfl_!:___ __ __ ___


-- -::_--~b_
- -P-rint_(~cg [Link] _qrtiJ_ _
· clctss inheri-le a ~ha e,, ---

clqasf RectqJIB\e~~: _
--+- e Ql_gg_l&_eU~±b w1d+h): __ __ __
' eq.:.!.!.::lc=uJd]j::'.l!\..J·-~ rec~rale. qreg :_,~jthl..width) _____ -
i.-----;---1....,__n,l.j. U,·o±-+-('-=-
re_c ~fe - Rec.tan_gle(J_ __ _ _ __ _ _ _ _
recta-Oj}e •C1 rectCLt ,5)

---- - - - - - - - - - - - - - -- - -
·--·--- - - - - - - - - - -- - -
litttiJllli~==- ··-· - = - . _ : _ - _ _ - --

I 11 ·R &c:erHon bandl':!3 me.cb9nistn :


.--tt-~ C ~ . '.cn_-h\pBl_in...sep1qle._exc _ epl:.J::[Link] ,.yo~f-~=
e.~e_snec.1- _Lc_qc.froris_ ±o__ ~e_tctken_fot_eQch-~ _F.e.-0 --- _
1

----t+-"-'-'-cep-uo . e_cr.der _oL-the_exceeLhlocks_J'.:L Jm10 nt_ r½


--~: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] :


c...,____._p_~thon,_-\hetLa[e_3e.\Lete1Le.ttox_ hand \i~ _&if~ i~~ ~
_ __ ]o
-·· ____7
0L1_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
an [Link] eifoflS ·

[Link] \ • [Link] fallbctck mechan1:Sms or- d


d~rad ci.+i on al\irna.~ve pq+h& ro handle. erro~ ~n
ow ro rbm r e etll-\ion
6~ CodeW ithCun 0ll~ Corn
1

Copg119nte
siraie_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,
or re\evctnt
r
udmioidrct+ors, -
keholders about error-S - •
--- - . .:thro49h. [Link]. channekl ·
.....
- --·- . -

Gracef,\ _ _ Grqc+.l -l:etminct-l:ion. ensures d~ - -- -


lerm,nution _infe.9t1 ~ ---and avoicb_ leavif23 [Link] rce--s -
. - - - - -- in .an incosshskn+ __ sta.k.__ -- ----

------
·• - -- -- - - ---·-----------
- ··-- - -----

.. - --- --- --- - -- --·-- - - -- - - - - - - - - -

---- - - - - - -- - - - - -

,.
!

I
I
·1

(op~,,.ght-cd b~ CodeW,thCuri'ou.s Corn


I
-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.:

' II
: 5Lf

. . . .
Oot,i :

~ u.~ in ikah)e.., forrn


1
va\ue., 1 e:

15

Cop4y(q h (aj rn
---- __.,.

---

- - - t - - - - l - l ~ ~....A..;2_- ? - ~~!...!..
...=i.!:~=- ---L!....l .i.-.:Fo=--
~,:C..ll= -.::==-<- -.._,_._~.

-~1• f---lc-'===r--:------J..!...l--L..LU..,,_._-==-i,t----f-!~~~---1.! .!...l.~ ~...u~ ~=ch,_ w~e-~ -

r,
r ab -llie '5

on

E
e en+ t
-~2•·-- ~ -.._ ---r- ----- ----t ----- 1r--- -'"'~ [Link] L-
,n---- -;
- ~ - - + - --- +-- ---- -;~ ~ - ~~-kc_k_. ~

3~

COP\lri~h e.W db{u~o LtS . Corn


-- - - - -
E01--o~e;~lion__-_ _____ ___-_ ____ ___ __ -
---- - - -- ·- - - - - - - - = =~ -&..: CD;; . .i.-- -
-\e
®

1)

25

. . . . .
coP u..,, ra tJ..<nl()_,,.lotJ,·lh
Ii''"
, '
t , , .. .,. ,

·d'
'(O\ I

I
Ya

CoP.~riitb iihCUeioLt~ · Carr,


D1t11: _ _ _ _ _ -

/~ --'fera.+JonUn__fji\ioo_:__ _ _ _ _ _ _ _ _- _--_- - --- ·-


_,
- -- ---
7:1==----------------

25
0'l''

I • f f ' '

:n

. . . . . .

Cop4nghiQ Co [Link].a. Com


I •

-- • I
Dole : - -

:,\e, 1: l)~~t---tn.e_t:tlli'Jjj__:___ _ _ _ _ _ _ _ -
~ - - = - - - - - - - - - - - - - - - -~ ~1.

Even-s =-

l'J )educe, :-
Doti,· -

------- -- -
-------
-----
--- · I

:5

25

- - + - - - -- - - - - -- -- - - - -- - - - - - - ,
D,11•

~~~~.i:;,__---;--------------.--------...._
'
-- ,_
Oat,!:

- ...
- _e._..fi:le.s [Link] b ~ , s i~<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 ~U e. - - ..
\~ - -~ -, -- - - - - - - -- - - - ---~
J= == == 4= == == == =~ == == =r ====
F'
t-+-----,-.J.J,,.__l,~h.i__
tio~-~
_ l _ l . . . l . l « _ [Link] .__ l l J _ J ~

..J--------1~~~~~[Link]...:._.[Link]:,._.[Link];.,,_~L.'jt-de-fau1
~~_u.,~'--
· _._._.e__
,.: l-_

_ _ j _ -- - -- +-.. µ.u: ._-- 11.!


-
S~~ ,J__ !:j:~ ~il_ _.l. lil., _~~ ~-i~ e_

5 W

\ 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,JJhCr17r7 fl1e,~ ,(l\ wi


Oot,,.
Dote: - - - ·

-----·

I f=?C:Q/)) le. 1:
---
- --

l
fl 11 •

I { • f

cl "~ji,1q !h C. Cltrr~h I ~ J, r~, /0lf


t\l~il,1 •J
. ,;

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 de/;,/;__-/h~ ,sF,i);c
& •

is _4se_J :lo dire.c~~ ·•


~_., lfie ~nto.x -lo. ..tJ,Se. -/:he; _rmdi'[Link] _rne.[Link] .Is 3iv~11 belou.J 1
- - - - - - - - - - - - - - ----
-- Sjnf ctX:
~ _Qi- irndif[di~c/;JH h_C!'!)-~- - - - -

=--- f,amflc.
---- -·- - - - - - - - - - ·- --
~o:
=--- 1h; new -dire;JoJ
__ , Ot rtn~ill "ditec/o~ nctrr1e)_
_____-_-_--- -
_ __
- ~~
.i

=1 l))i// temove +hu e,;J,·J_d1~a~g-;---- ~-~-=-:--


. -
. ' (0~1J,}1:c,hi(J'rn,l,Jd11cn .~;~,o~ '~M
..
J •

csy. writer - Wri.k :lbe dctl-a :ta a C6tlle.,


[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
--- hL9h~ sre.cial1~~ ~n-\Wh~t_we..can .Lise.. tQ__ fi'nd or . ma-kb.- i
ic:
--:/.- 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
...-- ·:#-imr.o1+ina ~~..mD.d~~'- - - - - - - - - - - ~
---- . +Je.,--.J__ - - - - - - - - - - - - - - - : -
___ 1mfof

== 1'# --- - -

llie,-re- moduJe,_j~oy ves ::fulLsufF~ u . l a I expte.-


or
___,... 5S Ions -- - [Link]-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, imriem_en:lu~-~


__ _USI r1j ct. ~LJ-1 Cl Y----.€)(rtt&SI.............__ __ _ _ _ _ _ _-.-

= ~
~:"1~la:ch~r;:;-rJ~r:[Link].\ cbqrade1,c
t
------ -,-

=_
: :Dii_.:
__ .. _ __
JLma.-1-ches__~...di_qr~r-s.~k...[Link] Ii ne,
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:.
- ·- + flu.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 fY7 ("I
o,,,!. - - - --

~UAJ_~~.UU:!,J____i..u.J..U:~~~-L-:-=+,uJ~ ~ ~- ~ chamder_~
.

25

·(opLf)fo ht [Link]~-i'cws·Ce 171


D.:il'? - --- -

/ --- ~- -.- :-- --- --- -~ -----


-eomrile~ ed :lo :!urn a lijLl l~_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--.
r I ' s · .

(

16 ·Web Develor-menf -With P~thon


-- -
IGI In.\ ro,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_ - -
_____ _af\l1-cnl-i ~ U o r o t1
e, .s-6:l:iC-W ehsi...-ks_-b:i _CQJllfill<,
> _d natni.L__L LILr ~-3 + . 0 ~ ~ d1onc;k1 e.s-.
" jlhruu ~jJ°f.91
_-1--', -u..[Link]:
.
,mRl,cl
~o ~ .
7
ill~11!'
_rmdol2t!Lt n
~y
w
tU:Lde~rPL=.
de,~ ~~
eb Ftaooewodss and li~tiP8 avru15:hie.. for dmJ.or_gr,s·.!-'----'-

~ ~=enh ~ Web develofmend: •


IS

Froo±- end :DeveloF-11'.lf.1]:l:

DOI's : u ranas CU) IJJOJ~ li'ke reac+


kt.~ d used ±-o s&eam/,ne, fion-1--
Vne .,Js are ofko
. . . ._. _·_ __ _ _ _ _ _ _ __
- - [Link] l°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] ~~


_-LJ;lQ±Q._mlffiD?[Link]:nllil.ll__!w.L~L-UY...:~bs~w~e
, We6
JI -[Link]:&~-u.c~.J-\,L_n

You might also like