I PY1HON]
0 whcrl is. ~-\hon :-
ClS'eJeol b~ (nUIOO VAN ROSSUM
( Out~ As-09tl'o.\<vl W\e..~ ) - 199 I
0 Cocle RevsGb'1\i+:j + tI
o Flree -lo Use
+
0 ~1e'lr~eJed LaV\sVCl~ e C II fv\o,l<e it slow in p~oc.essin 9" )
o \.-,\,~\,, leve\ Lc.\-\3 uu.9 e l t
0 Eo.s~ -b Leo.~~ ( LI
Cocle ~rn Fewe~ Llhes'' )
0 Potkble..
o Wo1rKs 0~ o.~~hi PIC\ltO~
0 Rich Lib~a~ies
> Web Dev
> Sofiwo:1re Dev
> ML Zr Al
> ~OJW'l,m ~ Pio~t1CVN1
> Netwo-rKin~ Plfo~~Cl../t-Y?
> G,ul
> Avclio ~ Vi~ Arp\1~ovi'e>,-,
> Sp~i~\ Plf~G\Wwn,n~
o Vobiobles :-
A vo:~iQble. irn P~-H, 0 i,, ~eprese.nts o hO<JWl , cl
loc.o.ifom +in~t 'ls'e.fe~s -1-o CA vo.lue.. amcA
who~e VQ(ve.s co.rn be useol OM~
p~oc.ess-ed duc1irn 9 --""e p~o9cto.N-n ~un .
o Odo. T~pes :-
0 Norm beb's :
· .Tmie~ets
• FloQ.tirn ~ 'i=b,mt Nuc-mb~
• Co('r(lplex Nurmbe.~S
0 SToiM~
o Boc\eruv, Values
0 L,s.i., Tuple ., OJYlcl Dk-HoV'et ~~
o ~illon VmiQble.s 0
IC"n
P~-¼o~ vo:~iQbles O."IS'e hot c~eo.tf>ol im -\{,,e
~-ircrn ('r()cs+ othe~ R?r c <3cr Q.fYY\l'Yf'I img
lo.rn9ua'aes do. These va.~io.bles do not
l,iave -H"'ed \oco.·-l-iorris ,, umlike othe~
IOJY\ 3ua ~es . The \oeo.-ttorn 5 -H, e~ 'Ir e+e2r /poiCY)i -lo
dio.m~es evel)z.j -1,'(Y)"le. .-1--heicr value. ch°""''oe. .
o One im1e~estim9 -H--im9 -lo noie while. woc1k1r,,.9 wi-Vn
P~-\hov, Vo.'b"io.bles is +hQt whem we. cJrea.te
o. va:~icble.. ,, we CAc.-\.u'41l~ c~eo.ie. ~rt\ obj'ect
SoO"l"e\,J'ne~e im -\-he- rmeimoc)'~ w 1+h 0. umiq,,ue
ro,Qppim<3 olS ID/ Acld.~~ss. We cam see -+his
urn·1c.vve. ID ~em e.a0.1ed a_gqimst each cbject
U5irn9 idt). pe1im-t ( icl c.~..) )
Tro P~#lorn ,1
Va~·1Qble. de.clq}'eol E>utsid.e -tke. ~Jiom
~-Ye C.Qlled °'lobQ.\ Vo:~iab\e.
AC}'ld1 Va.criak,les. deda)'eol ·1 ~ -\he..
-t\ft"r\c1iom Q~ co!Le.cl Loc.C\.l VO)iqble..
0 Ope'\S'a.to,ss. :-
S~rmbo\s -thct+ pe'b".fo~ ope'b"~1'iorns &m
vcririCl 'al es evvid. vec\ve.s .
# A~r'r\-hrme-\ic OP.e~a-toYS (-
0 .:: 10
b =- 5
f?riN'l-t ( a +b) # Acldit-it>n ~ IS
p-a-,("Y\t ( o.- b ) # Sub~a.dion ~ S
# Con-o~h 0f.e~Q1?,~ ,_
p~·int ( o. > b ) # Gwe.o+ecr -fhQ'n! ~ue
p~i1-1t Ca.;: b) # ~o.l -1-o ~ Fo..lse.
# ~iccJ 0P.~1o~-> ~-
pa-iht ( o. > 5 o.md b <.. S ) :II ~kGl AND•, Fo.ls ~
° Condi.l;oV\S ( if- el,f-el~~ ) '.- Allows y ou -to execute d,,#e)'eJ
c.od.e bo.sed om dJfPe."J~
eo~d.i.\-icro .
it o.~e < 1g:
p<1int ( ' Minoa-")
e\i+ 0.<3e =-= 18 :
p)i"'t (. " Jus+- -tU)'hed od.u\+")
e\se. :
pc1i~t C'' Ad.oli")
0 Loops ~- Allows ~OU --i-o exec1J1e a b\c ck ct- code ~ereJ-
~_'j .
# Fo)f LooP- 'r-
~~ ,m 1racn9e.(s) :
p)i('tlt(i) # Pc11h1S o -b 1
=II: wh,\e le OP...:--
Couht = 0
wh,le c.ou"'t < S ~
p~h,,t ( count )
covh+ t= 1 #- Bri~1~ 0 ~ 1-
0 Lists OMd Tuples :-
Lis-ls u~e 01rc\.e'lfed I mufab\e.. cclleciiohs, ~ ·,-b-rn~ .
Tuples oore. ~eel ,, ·,rmtmui-o.ble. ct:>llediov,s &f- i.\eJms..
~ ,I
Ta u1t~ ==-
[ I(
app
Ie 11/ 11 b ano.na ,, "
"hroits. o.ppehd ( ob"am'je 11 11 )
~imt ( fuih ) ii= [ 'Qpp\e' /
C.ooidina+es - ( I0.1 2.0)
c.co2rcLVta.ies [o] = IS :/I 1'his will tra.ise o.m ~crc2r
bc:co.use -\.uple.s acre
im "7l o~a.b le.
p?Jim-\- ( Cot)crdiroo.-\es ~ # ( 101 .2.0)
:JI: Shslm9 Me~ods ~-
Me~od.s used -ft> pe?sfoicrn ope?l-QiionS O\'l s-kimes
i--nesso.9e =- 11 i-le\lo / Wo~ld ! 11
pb'icv,t ( rmessG.9e. le>we~t) ) =II "hello \I\J ob'ldl'' 1
pb-imt ( ('r(\esro.9e . Ufpe2r O ) # " HELLO/ WORLD~ 11
pcnmt ( messa. 8e . 'irepl~ce l "Wo-a\d ,. / P P~ihon '' )) -#- '' Hello/ f1-t\,on! ''
:/J. Fundions :- Block of code -t-hoi pe~'ltrn -1-o.sk amcl
(.{)JV\ be ~eus e°' .
cl~ ~?feet ( nOJme) :
+ Hello
11
.1 { no.rme, J ! 11
Fm+ ( ~eet( "A\ice" )) # 11 ~ello / A\acel "
#- £~~H>l \.-\0Md.lim.9__::.- E-rro~ horn dhlY\g a\lC)W'S 1:3~u -f-o CW\Ct.rr\Q..9e.
-------- ~'cJo~ usim9 -1-~-~tept b\ocl<c;..
~~:
-aesoH == \O/o
exce.,r> 2.eb'oDiv'isionE1rn>t ~
;--nq~~ 1 fl'lht( '' Conhot ~vicl.e b_y Ze~oJ 11
,, . )
hQ;1. ~
pth,l' ( ~ Tus ~hS ho rrnoi\cb' W )