Python
Python
* Pthon
ihoo 1s a qeneral-
tAnfta purpOseioterpreted;interattive-
Obiect: ortented _bigh: level
Language t Laas _cLea ted by pr0gramming-
Aurinq 85-1990ike Guido Vdn Rossum
also avallable per python sotice
Under the GNU Geneya code s
(GPL) Thls tutorlat give genexaLPublic
Public \ceose
ltceose
s enougn unde
Pribon pidqramminq langua.ge- xtandng D-
l hy to learn python
ython PHbon is desiqned to be hiqbly readable
R uses_enqlish
ketpta.ords reqentty u0here as Other
Languages use punctuation it bas keeoer
Syntatcad con.stuctions han Otber tqnquagce
characteristics Python
ol are imp: dhar. oPyhon progoJ
I spp orfstanctionat k Structued Pioqa mminq_
N,
methads as oetl as o0P
than isnteratre-
yotta-Aduallycit ata
etlo LOOle usin pyBbon
JuM to qive yoo little excitement
aboUt_pyth0
Tm 4oinq o qive y0v a small con ve
tletto Lorld paraqramyod an try ntieno pytho0
hok it _Uslnq dlemg
Priot hettoOPythorn")
DATE
pyhonstinqsi-
Stinqs io bython an ldeotitiedqOataNonontiouous set
charakers pres ente d in the qhetlea-aele.mork
Python altotós or ether palys Sngle oy doube qpoeg
Subses K Stdoqk Can oe taken bsina the slice
Operator[i and ti1) talth tndere S.tartioq dto inthe
beginning 4the trag_dnd 0okinq their caay
O M : a t th e end:
PAGENo.
DATE
The
The plus ) Slq s he stmng Concatent tiao
pe scLtor t h e asterisk ( ) ls h e repebton
Openatodr
ve /usY/bin/python
Str =teto Wovld
Pytho n Lists
Lists ave the mast versatite
data types A tist contaias o Pythoni compound
CommaS and enctosed_ items Separakd by
coithin 94pave brackek (
some_extent, Ifsts ae hmilar to ausay_in t:
Aeence betoean them is that atl the one
lng to a tist ems bt
long=
can be diftexent daa typ
Ihevdlues Ctored in a lisE
the slice Operator (CJ and ean
C:1)
be arcei scd usíq
dt 0 in the beqinnía o the lis olth iodexea StartiBa
to end 2Looktnq
the plutSiqn t's the tdot con their coay
OpetatoL, & the asteris k (t) 's he atenatiao
OpOrator
epeti don
/uSY/ bin/pythoo
11st
t abcd.", 786, 2:23, "John,
7o 2
toylist [123jo hn'J
ython Tuplés
A tuple ls_anoth er
scquen.ce daka type thatts
Slmilar fothe tist A tuple consist[
Vaus separated hy comas -d number
tuples ae enct0red totthin UAtte ictsbooee
pdranthere
The maio dktevene
ists eve encloce d in betoeen tsts tuples ani
Size can be brackets(CI) &ther element
changed, Lohitetuples ave entloso do
paventheses ) Cnd Cannot be entlosod (0
Can be houqht d as vpdated. Tuples-
epdated. TupleS
e'ad-onty tists
r osrbin/pythog
upte abed',
ny tuple Ct23 7s hn' c, 22.3 oh
o2)_
3, 'So )
PAGE N
DATE
/Usybinl2ython
tupleC'abcd' 223 2.23 o 2)
tis abed, t6, 2 3 'john ', to 2'
tuple (2)- (oo0 Tnvauid suntax
list [2) =tooo # Yalid syntax with tple
tiSt
PAGE No.
DATE
Tyhon Dictlonciy
This is one
Thls is too
dept sales tode' 6734,naoe:ohoL
dept 'code' 'nam
sates G34John
python ldentikiers
DATE
ConvenionsfpLpython
Heve av namin9
tdenbkies
ctass name Uppercaieltfer.
stats olthg a0
Al othe identifies start d'h a lowercage ltHe
Hetto pytnor
pythentestpy
PAGE No
DATE
make
make iostaL_
alindotos lostallablon
Here axe the steps fo install Pyth o n dn hllod ous
machine
History yih0n
Pyibon was de vetoped byp Guido van Rossom fo ihe
late e tahties_andeaIlydine tHes at the Natonat
Reseach Institute tor Mathe maHts and camp:Sci
theNethertandg:
Pytbon lists
Sinilas to
stuaqncdicesfistindice
and tists can be sliced
concate
Stalt_at 0L
ndtcdand s0 On-
Wo.
PAGE No. |
DATE
Syntax
de uoctionname paYameters):
unctio O-docstrinq
Kunction-s0i te
returo fexpiessidn.
deault, paramettrs have a posiHonal behavinur
And you need to iako roohem lo the Same thc
they aere clektoed.
Example
lepriatme (str)
Ibis priats a pase clsinq_inn tinís koncha
pzlnt sty
eturo