0 ratings0% found this document useful (0 votes) 111 views32 pagesPython Notes
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
Python : -
Pytbon rapenniag Sorguage wor diveloped by Six Guido
Van Rossum in 1994 -
Prion i an Cary to Soain, powesful Dbyect Oriented
TEA very Pgh Mel Sooqoage bck mak poueyfat Ween 6, C++ 4
Java
Eory sto use indoprater, Sosgse e-
*|TH i object ovieated erpoumive gpurd open source Seogugae.
TS bs porteble and sealable -
| Ritdon Veowion ++ Ss
Python 0-9-0 - a0™ Fe saga
Python O94
Python 0°9+2
Python 0°96 - April asa2,
Python 0.9.9 ey,
PyBon 3-6 — Ab Sep Aooo
shen te
¥
ae _ETT
a
Radon 3-0 = Decembey 2008
Pon 3-7 xy Buty S898
Curent veuion in wide UWwer practices - 343
Note :- :
PRtbon prapiemmig Sogquags Drow at Mo nome python
Qfter famous BEC comedy show “monty python 's fyi
ny scivcuy®,
ey, in Python t-
Working in fyihon
aInterackive Mode Sexcpt Mode
| (Python Commend Prompt) (Pithon TOE (Gur Gass)
() | Tateractive Mode + -
ey ihe ad,
Sradikional commond bared application whue Me keywords o
j ond Syntay's wes ured by Po Weyto communicate to He
python Libsiany ila ond Wan, we ae gt Po scott
a Sept Mode 1h aon o Ue ort to Work in Scoipt mode
on Row i a name so go prypiom /scxipt and Hun
module by wiry te wteph-
(@)| Cxedte module | seaipt | pregpam ile
| Run module I seaupt] progrem qile
Before wing ty python ie cry mode we must
L ‘instal Wo python in ow System.Tastelting Python t-
~~ Bython is Open sour agnamming \o
Yihon pen AcuMCe Agger Aguas
a con get python by dghoult: rom Wo website aie
PyMon- ov: “this by dujoult installation is called Cpython
'astaiiction rat comes with Python Tntexprater , Python
re 4 pre Package Tarball) -
C Python =
Pha Sows important module a) © python hak is
+] Bo PI Ww used ov Ho conrole -
Bo PIOLE s te wrens workin module -
Ro ip & Ws gateway oF cheanel to add We extra
wes | lo python sport
ctoms CO mony distrilukions ovoilable
StPon Uke Anaconda Python distribubion ak og
caded with many pockgges ond Jibsrosy's -
‘Hou oxo many popular TDE's Bike Pydrar,
IDE , Spydey THE etc: Bure are very Supporkive So We
WEY os poy Wueiy Knoutadge ond Searning capability
which fulps in pregtom development.
rz
4 PIOLE + Pip
Token *-
am OF
codes):
A smallest individual vst in a pxR
Lexical unit (unit 2 Single words in a Dine
| Key words 35
We prodelined words hat Sapley o Special
ena ond Os mesisiag to Soapeye compiles | Fateorpoe.
| don -
| we Koywords ore —
|, - |fa b&w PK
G
iy
Gi
eee ‘import
1 finally in
Twe | nentocal | uit |
Th python exp cow only ree Keyroond
seiting with Copital Oebhey Ute, Fale, Nene) «
tterls 1
Wo torm Stora means conrtant volver. A Sived
Volue Wat con't be ol © duariog Wo P*BgNam execvation.
String Literals
“]Numenie Literals
+ | Boclean Litenol,
|Special Literals None
‘| Literal, Collect
ions,
. String Litenals t-
“Wore axe seb 2 characte, or « sequence
9 characte, sworoundad by ~
Bt get
Siggle Guotey C1) 7 Erte | Comp
Dovble Avotes (" ") > Es." Komputer”
Triple Quote, (* ") Ext“ Compuitey”oe
w
ND)
a
oy
(@)
ow aro hwo dypes eX airing in Python —
Siggle Line Strigg
Motkitsne Srigg
SingleLine String +-
a 5, Bix abving Whe tock hat i, Uvditten ia
Site guoter U' ') | dooble quotes" "J ox triple quoten C™ ")
is completed in q Stage Dane abatement.
>>> det = “Helly” [EO
entey
ubki bine String +>
Hialaanede rage When Yo shin gfo Single Sine statement
Ys spread actor multiple Dine od one Siagle atving Bon itk 4
known O4 multine strings .
Python Oecept Hore abrigg in two wepe
By Oddigg 9 bockalash (\) ak Po end of normal siggle /dosble
quotes string -
‘ dept eo TN
sepfa = STN ans
aay C8\
es) Sint?”}
}
wm
lEr= w 7
am
cS,
inal?
» | Nomex Literals +-
pee See Lidavals Las Soar
type -
@ WEL Signed idteapen) 3+
Usiout decimal peints
w
©
o
dy
loot (Floating poitt soal) dombey) 2-
iat (Floctipg pit sual comer)
powtt david,
wohaee Tmasinary port 4. 0
Note +
Mon
Bove tise type | intege a
int For short inde =)
Sony (For big iectegon)
Reborn allows “oer Sypes 4
Decimal Trkegor Literals
Octal Tategon Literals
iy
Hexa decimal) Ttego Literals
re
Without odding backlaah butt Jor the deck ia triple oe
difpoart- numer cal
AM whole mombey 4ve or -ve Aymble but
Keal numbex with a decimal
oy Bo \ Jer and doch ovial porct.
Lemplex (Complex Number) % “a
mwmber is We dorm 9 {a+ ib) -
and A Soaks,
or wegen poh
rogamming Dopay, Ske ¢, 644 4 python ver ion-2
7 a ee
but in Python 3-% (Python vewion-a) only one degen
Sypecclas inks Support small and Dong inten.
idea Ditorals -Decimod Tategen biteraly \-
jEyi= 428, 443° ,-43 , + 909, ete.
Octal Lotegen Literals *-
A sequence Q| digrts ateorting with o
Y= 20,906, -13-9
Ware ong also called sat Mitenols her
Exponent: Form ; -
Exponent Form
Mantime Exponent
CA inte gay or raat
constant)
. | Boolean Literals 3-
Boy wer Wo boolean exprarsion Taue ond False.
oe,
- | Special Uiten ols - None t+
Tt W Like o nvll volve -
None ~ Repsrent Ay alrence 2 valve «Python Chanattenset +o, a ctey set is a set @l valid characte
doutand.
“thet a Sepguage can UM
4 | Leto s-
A-Z, Og
2.
igits S~ |
0-39
9: Speciah Syrnboal :
spece te LN, EVER ELE
coe |
4 White spacey * -
Bladkspace ,tolba , 2 (newdine , Jowaleed
5. Otay chanoctey 1 -
AscII , Unicode
Le
Tdenki
iowa 2- = ,
Pur idertilous axe Do nome in python pryrorenigg
Pare ames oxo ured to ‘derby Vadakles elas, methods pjorctiony.
Roles So define Yo identyines 2+
We only Wowed eharaces AZ 0-3 fs 0-9 and underscore)
will be alowed. : -
cy Teest fxs Mould not shoat wit nombou ov daits-
a
qgezs = 30 ~~ Nolid
SsSage = 30 % — Tavalid
Wl Weed Wr he eng its Limit Jor on ideatilien in Python.w No Keywords ane ured On Wentifion «
“Tave = 30
Syntoy error Cont omign to Koyworda,
w
Ww
(a)
(by
Ce)
(d)
Underscove with idethion a
Pit sai ts «at
|
v qT
1
© Privete Vasiiable ® Pratected Variable © a ie ar
Ain dentition stadt Yoo Tdeatifien Me es
with underscore . Aroits wilt, double and end wit,
t-) Stove (--) double __ -
=e 0 | Tee | [=== 20]
Operster +,
eee Zponcters eva Bs Sekeas ch dye sone compat
19)
when sed with variables or objects in on exponion-
Nastioble ond Obkjeck, on which the Compution vs Perormed
ore Called operndy.. Operstor
fe ml
= Ce Oth
~
Opernds
Unory Operatores a
hore operators What seyvdie one opernds to
Pe Jom te operation: :
Unony Plus t)
ee k=)
Bitte Complemeat
Logicad Negati on (not)Bina yy Operctores a
Binany Operator
@| Pritfenstic @rituine Smit Dreakty © Relatinnd
openttorcs operators Operators Operstors SPeretey |
|
) Membership @ Assianmest @ 1,
Operctors Operstors Yet
Operator,
Q] Aritdmatic Operators \-
Phe say), ey UT
© | Gihoise Operstons t
AND =A | OR= | NOT= ~ , KOR= *
© | shit Operators »-
Left Skat = 4% : Shift > >>
@ Ldestity Operators cS
ia, not
| Relational Operstors +
¥, e;
Q| Lerecl Operstors +-
AND
Q@ [Membership Operctons :~
in, notinFonctuatows +
Ponctuctoes are Abu symbols used tn programming
lon page to PEorized o sedtonce struchoies exprwrion + preggo
Atnvuchuiey ,
WP FEN OC) fe © ass
Syascueiny ey: |
We concept a Syramicty pigg in Python is ured gor
daickgy & verisble which some wolves ata me bubia next mavemedl
‘Be volve af dijereat type is amign “Bin ia called dyoamic typing:
"= 40
print ony
Ae "My Cs" ~ 4 iat 30 |
protiny
Shaki e Typ
"To akatic typing © datatype 1s attodked with a
Variable uahen it ta defined Jivst and Ht is obo dived.
"= 20
int datatype is attached uitf vaxioble %.
Syanamic Tying Vg Stokic Typigg_t-
Datatype 9 o varioble can| Tn dynamic typing Whe sbove
not be che sostrietion axe act token.
Pigg .
ged in static
adeBasie Pon Syatoy
Unit - 2 a tS *
_—
Baie strveturer 9) a Python Prggsiom *-
: del you, .
Fonction a print C'lelly C5")
ste moin Prgg Ham code follow
Q@= 46 .
Eypenion
Statement b= a-40
Prict (a3)
pent tee incnanidecnaneidimehiiniai ees, 2
i . 4's @ block
Tadedaling ——J B BPE cabo mecns ee
Print ("Volue 9) 'a” was more Wen 4g")
ees 4
pritt "" Volve 9.9 wor Ag ov lem")
Indeatahiog SMO st Colling above Junction gran)
ie
Taline Comments
Ex prersions t-
1p)
ay TEIDD Mame
1A print junction without ony value or make ox eypromion print's a
blank Le -
+ [T+ appends 0 new Line chanactey ot 4Qe end 0) Bu line vale, you
Gre your own end orgguments-
Ey pridtl "My nome is Ayush”)
prist("My claw ia CSE 34 ye0y”)
Odpat :-
My name is Ayush.
My clam is cse 3°? Year.
Note t- fee!
ae We end oggpm ents wy \n*
WAP Using Rikon so input weltome mengge eo a quast a
dirploy ok
wae wring Python to cboin 3 numbers prints ain sum -3Bvestion| WAP ko dotsin Seoath + wish gf 9 sroctoogle Aad colette
A Amwey| 0 =
TA Mug.
input” CEntey welcome menage ae)
priat la)
2 Arwwe! Mums = lick Linpu (“Eater Jirst number * Dy
3 Angw o4|
4 Bvettion-
fum2. + ink Cinput ("Ester second number + "))
fm} = ink Gnpuk ("Enter Hand number + "))
print (" Sum 2°, atb+e)
upg, ~ flock Gopuk L"Enten Be Sangih +)
width = float input "Enter Hu width *°))
Odt0q = agg % width,
pridtCaaa)
WAP Xo ing
Bou
hecomes a i aan etree
ng = ist Cinput Ester fect number :")))
My = ink Unpack ("Eaten second number .”)) |
03+ ink Gnput U Enter Pind number") )
ny ' My M3 2 M1 Mg ’ My
print CAjter Seoping’' )
print (mn, Ant 0 Na! y.'\0")o
Gy
(iid)
Gy)
\v)|
Data Handling *~
TaN barnes: “Tn Btbon dake handling is covered with vedome.
ty 9] datatypes , vassiables , Operators ond erprerion-
Data Types i
ores cra meny dette dypes Sike character, ints,
soak , shriog:
Any Hin enclared in quotes wv ahring data in Python number
without qection w erhggat data -
Nembeu with Pectin vw sv0l deta.
Tue 4 False ts boolean data
Note 1~
Ho Pragremmin legque s provides 0 wey to handle “Hy
dipjrast data types ae we aa as dato hondligg
Fythen gk{r built in cove dato types -
Numbers
Shing
List
Taples
dictonany
Core Vata Yer
J T = ~ aay t
[Numbers bet None Sequences ep pips:
as —h |!
Tips Ut Dichanany
ny
BosleanJust :- : fo
iw In Python 0 Dish sq Comma epenotaa volves Bfany
dota types between squout brackets C1
Be a= C4,2,8.4)
b= La, ‘cs’, 2, pA, 36,‘ Aadompuy’]
printta)
pict te
Ovtpuk !-
C4,2,3,4)
C4, ¢8, 2, uea,3-6 , Padam pur }
Set
betone very éimilax to Sisk that can stove multiple
valves Aame as in malkmatical sets.
Fython sets aro Little diflexant prom Lists -
Sets axe coaated by Specilying . Seperated values incloned }
y , values inclored 19 CU!
brockels § 3 - oT '
lex.
fdas f42.9459
Set2, = SAVE TOU
o [gets elements axa unord ead ond un-inderd .
+ [Set do nat alles duplicate eatryes.
Sets can't cortoin chongeble element.
Tides Sp wh cal
2 ara Ws List which cont be song chegye (no- ensd-
Jqiable )- Boy Osa suprurented 04 g40Up 9) comm
QJ ony dabtipe with in potent a Nees
ys (4.2.3,4.5)
Sy CAEL, 0,0)
By = (G42, $54)4G
Note :-
Ta Python data Objects con be g) tee types -
Mutedble (chogyeable)
Tmmuteable (non- chongeable or Lacheayedble)
Volves 0} lint ypes ou mutable (cha:
agcoble) { Ainy one can cho.
Odd) delete o Sust's elements 3.
Bub 48a volves Oo type tuple axe Immutable (non -
choageable) $ One con't make chagges to 0 teple 3.
Muteoble Types Tmmuseable Type
List | Seb, Tatggen , Flostigg Point, ‘Boclean ,
Jictionory Strigg 1 Teple
Vielonany s-
Dictionary Vs an exunord ened set of comma Seperated
Key t value pains usttth “iq curly brackets § 2.
Wits in a dictiono
be Ho Ame.
ly No two Koys can
TA means Pare bate ee
. Pita, era, Lia, 0.4, Uns 3
>>> Vowel, = Rie a tal 2,253, asg fules §
>>> vowels C'm)
P>> Vowel ['U'Y
Sting i
Wore-and Birger pj chonectens.
ietionany.
Ex:
Noxious types 9 operation Of Strigg -
Python can’t Concadinate o sing ws, integer
D> String = Bom”
>>> See = AShyan”
Dds Shrig at stheleg Q
>>> print (Stray at String 2)String Kepett: erchor 2-
gS peien Opsteter We con sepeat Wo same Nay
mulkiple types buck 42s one exprmrmton (eaquments) Should be wt
Aype and he eBay should be integer type dior wise Pon oh
machine show error.
>>> "computer" 3
Olp = Computer Computex Compuctoy
>>> Hello # hello
O}p x error
+ be
Formet Method Ty we wart so meyge two shrigg inte o sigh
objedt Pan dernet method U is ured -
>>> ema 2 30
>>> Wmaiks = 40
>>> mmoles = 20
>> Subject = "Pdon”
>>> Avengge = Lemans + hmartes tmmortka)/ 3
>>> Menge a Tsg,my cag marks $2 Wied morta 43,
nath manila $3, mppoua fd”
>>> priak (menage -tormet USebject emauk, sh marks, mel
Pweg)
Formet method tokor unlimited numbey 3 angpments and axe
placed imho “He serpactive placeholden .
[Note ; -
Conversion Function *-
Pithon Mos many built-in lwady +e une)
dato type Dike int Cintegon + Sloat \gleatiay point oumbor) , ste egy
List, dick Cdictonony ) Hat far multiple separertstion .
Some ofan deka type art tuple , get Wat
Ara used jor multiple values oegoninction 4. Spurerbston ot \oyeScale 2g Pregnemming -
Bo convertiog between types using Be meted i known aa
Conversion Junction.
Fonction Converting Example
ind) | shigg fostig pect 84 dggoy | 22> Set Casas’) >> ‘eho
Olp = so2g Pp: 3
-| Sloate)
String vintggon Ep Hoctiog pat
Dd Sloat (90.22") ao float leas
lp: Yo-22 Ofp= 20220
+] Ste) [ist Sloat lst type, dict ep stig >>> Sty (9022)
Olp = 'ep22!
«| Gistey | Stvigg Tiple, set ditionany Bp tbs
=a rely
| Kople Y | Strieg , list, set E> tuple Dae eple tomate
ple 1g es rh Ole = Less, mpi #5")
-] seer [string , ist, tuple By set |??? Sek agayan) po? tek A ees;
lps lpssae Gamoenen
Uat-3 qe Soe
Flow of Control :~ a
=a Many PTEpIams rons Ht1s statements prom begin niog
to end many prepiams not wun Hsin statemeat in Wo propery “tay
ordey ion begin to end.
To solve iy problem Python provides a se dor Wore
statement +o von in Propet order Woy ane called p Prapem control
statement
Pipes o| statements in Bion 5
Stotemesb, are the imstrucHiongiven
[ro the Computey to Peder ony kind Q| action Dike date
oy dicisions and rpeatiog action .
le 7 WW) t+
Sehr stehemet Coot) Pion ures a pars artotement Hat does
nothing -
1 Movemedty|
* | Simple Statement Giggle Stotement) + -
When a single Dine code
Wat ror been execuated Won state 3) u
ment ty ured.
eee: Snaine = ‘apa Enter your shatement 9)
Printinome)
Result — >
+] Compound Statement
Ststementt Flows Contwal t=
Sp Bey Prapemmicg Toenege proves cont,
ct be Support, sequence , selection ov iteration .
Sequence Construct i
peente Consbrvct
abe Sequence conatruch meany to Atohement
Ono been Rrecvated ina MSpesnse Corday).
[Statement 4
Fate ment
tee
[Statement 3]Selection oustct °c, consbnicl enaann He £98 tuaay
4
Hon test.
bass Q| He condition ;
Agent onthe See ecadAtaastatioue si ihl2a will be
pelformed on We statement clPorwise to next action will be
q + astotement +
Peyermed, on di, Joran atotem (Lningpoition J
Anothoy
Lne
o
Statement= 1
LT
Stotement-a
Trenton Cony
en Cen eruet
action
Iteration esaxtruct meons $e sapetition
ga set A rrotementy depending upen a Condition tert -
Be exit condition |
True
ic Statement-+
Statement-a
Larstemsaria. |
Note + (Heretion Constyvet)
Tr teraction construct mamma {itl Pr Kime 4e condition
Ws dove a vet ga Atotement are 20,
seen an By condition becomes jou
Bo Heration comtavet ty also colt
peated eein ond again a»
€ We sopetition is Atop -
ed rooping constr et:
nih 4|
if statement ef Python “~
iS Reese, xs conditional statement in Python
and emeliment Selection construct:
Ds } statement tos a perticulay condition ¥
ak ip tre Hon Sine of action + usll be ‘token oPerwire 42 Sine
QJ ockon iy Ignored -
iy Ceondifional experi on)
Stotement 1
Statement a
Indiatahion Same
Note *-
Tndintalion in Python is vary importost when you axa
using a Compound wtatement- Mokke Auxe to indent att statement
in one block ot We same level -
[Ey
A = int Gnpuk (waite fied number'))
B= iatCinputC! wote Second number’ ))
if ASAD and BAG +
print C" so sasutt iy", A)
print (* no susutk”)
[tbs iy- else stotement +-
he block below if get excevoted if
Pe condition is trve ond iF tbe block below ele if Get eneevates
Be condition Us dole.
if UConditi onal erprornion) +
Statement
LStotement)
ebe:
Statement
L Statement]Quettion-| WAP Bat stole @ romber and chuck weather Ale nomber is 94, or
even- \
Answer -| num = int input (Eaten a number ”))
iy num72== 0) + .
Pritt" Su number is even”)
ehe:
PRA Rs nombey ts odd”)
f !
etal i. Sabomert Ws hctement Das ovr deems .
Forey-a = iy ingide if" body
~Sydtey 3
i} Condition Expremion) «
iy Ceondition Expression) 5
Statement
ebe
Statement
ely Condition Expremion)+
Statement =4
Statement 3
}
|
|
che:
Stotement-4
Statement-&
Form- 4 - if imide elif's body
Sythe 3-
if (condition) +
Statement
elif (condition Esprwmion ) +
1} Condition Expraision) »
State me ats
ebe:
eis @ Statements
ekForm-} ~ i} imide else's body
| Syeikax =
Hf Condition Er prerion )
Statement -4
Statement- 2
CNif (Condition Ey promion) %
Statement—4
Statement-Q
else +
‘y (Condition Exprenion) +
Stotement-1
Statement-2
ebe:
btatement-2
Statement -2
Form-4 - ‘Uf imvide Y's an wellas else ov elif body- Tgienultiple ifs
‘inside -
| Syntax te
if Condition Exprwrsion) %
iy (condition Exprenton) +
Statement-4
Statement-2
ebe:
Statement 4.
State ment-2
li} condition Expenion) ¢
iF Condition Exprersion) 5
Statements
ehe +
Statement,
ebes
ig (Condition Exprarsion) +
Statement
ebe
$tatem ents¥
Question -
WAP to print weatPon a given character is O9 Uppercare Moun,
core oF 9 digit Or Any oor ee
chor = input ("Enter a character”)
YY Wchand= Aland chan <= ‘2') *
print (" Tt iy an uppercase”)
elif (char S= (q! and chay <= t2t)t
priot "Te ts in lowercase")
elif (char d= ‘0’ ond chon <= '9)%
Print “Te iy a digit")
eo You ane giving special chanactos")
Ws rose) Junction i
—S—Fegunshea Pe soaget) Junction a voty important Pet
wed with 42y Jer loop in $e Paden. his Junction Generate
Gists which 4 4 Special sequence type. A Sequence tn Pron iy
@ Suceem or of valves bound tye ier by o siggle name «
Tange.) 4 E
Simit 4 upper Gimit rus ive on works On tw0. points lowey
*egge (Lu)
aa Upper Vind
Wag FE
Le ose 0.8)
mont J9t (0,4,2,3,4)
st 0$.9, 39, 427 tele C3, , 8 anyLoops te
Dee main two boric \oops ane -
: Courting loop :- :
Ys Soop Bet Sepeat jn Wo poriculey number ol-time-
Bete Fo loop A :
+ | Con
nal loop : Ss
: “Shes loop ADast sapect ata portHicelas condition Which
Le twve. Er Bon ile Neop ‘
[Jor loop t- : -
or - in pyton b dean to procen Pe thems A ory
Sequence Like a Dut oy & ring - One ‘ey one «
a:-
|S yak te
Jor vaxicble. nome in Seguence +
Stotemedt to sepeat:
fe
jeoro in CA,3,5,7,9):
pasta)
pristlow a)
prt Lotatay
Kalk t- 2,4,8
Fae
$,9§,20
Ay 49, 6$
9, 83,30uation] WAP to print o fable. gs
Alngusey t~ a=3 ’
for tn 642,94, 6,657, 8,940 *
prist(as a)
Kolt t- 36,9, 42, 16, 18 04,04, 09 180
oo
Num: 3
fora ie woage (1.53) '
print Lagovm)
Fat 1- 3 & 9 12.36 18 94.94 99 JO
Usig inpat method *~
num = int Ginput (Eater a numbex + ”))
if oumy. d= = O04
Jor 02,4,6,630!
priat (nom ty? 8 ist epaa) ,
ehe:
Seva inl 43,5, 9, 9)%
priot Cove ty) gq be e num ara)
Royult
Enter a numbey 4 § Eatey @ number? &
Soa2 8 Qaee 4
S4aj: 45 Bae = §
SF I= 26 Ot G2 42
S#A= 35 2HG = AL
fag ag Sb de =While loop
Ids wa conditional loop Wot sopect ro inrtwetion wD in
Urel{ Hilt Wo Same re cendition is bwe.
|Syftax
* cite Cnesieat Exprwrton) ps
‘oop body
| Procensin og Step. of while Soop *~
© | Bo conditional | lesa exprarsion wo he ose le loop
OF Coney om we, seanalt a) step ts dove Mon ol skctementta, 34
42 toop's body axa erecvied.
Carel 3, We oesult of steph in cplre Wan control moves
ko AQe next stetemedt gpter Bs loop end:
Body ye Soop ge executed:
his condition ts Occur jf Hs steps (eayeZ) executed-
Example. :-
az §
while a>o%
at ean. hell 65", 69)
Toop 3 Siz,
‘ ; foop &
, ile condition is tated ust ox gt l°P
* 4 at No 5". 5) = cumest valve 9} § executed
pre ello fj Z
as §-3=28
uy ao ‘ while condition is tested wrtg= 24 toop
prier'hello C5",8) — Cussrent value ghee a ereevted
Qs A 3r-d
ww] -20
loop body will net execcted,Lut:
r Lash wa standard dotatype in Rion ret con tore a
Sequence 2 valves belopsiog Xo anytime -
L ]yempty sist
T3423] +Sut 2) tego
[418.3642] —F Bist of numb
Cio bY eh} =p Gat Q| choroctos
Hane! “ase! oes] ee ust q ships
Ceol, "2" 1 3.5. Zeno") + tak of mined
Coucting Lit 3
PI re cracte o Sisk we ahold put We valve 9 O67
detolype in a sequence inside Bo Noy bouodket L -
{Types of sist °-
Een St ono Gust cantina enony elements Head oh i+ logy
Sisk we com spell ACovalves in new Sine-
Le 042,3,4,8.6,9.8
Ws Just willge on tN Bo chesigy
When a Dist have an element in th which It Self wo list.
ee €2.2,3,4, 06,62, 9)
Let noted wit 6 element:
Cassheigg Nisk prom sequence exeesting
Sp b= Jak Compton!)
olp = Sait int eu, tel]le modh commarly method is eval Uinpst ty) -
>>p dust = evel’ opi Utaten du 2”)
print ("Ligh us given. P ist)
Felt .- Ester Sash 2 2.2,3,455
List vy gven 2[4.2,3,4,5)
[Dictionary + -
Dick onwires AX mutable (chagaalele) UNordored
Callections uit elements ‘in “Be orm 4 © Keys volve pon oot
anociate-
dichonany-rome = § Key tvelve , Key: valved
pop Keachews = $" AK Sin “FETT” BR gies “Deen”
Note 3 : : "
Lo dicionary mush start with f musk end SAD, F mead,
erbey Q Who dictionary murt be woxitten in Wo dorm Of Mey wali
pair
“Were ane also called crrsociative egeroys o¥ mopping He
“Wo. key of 0 diclionany must bea mone che
TH mean it shold be a Pon aby
9 constant we: +
EPle Clonstaat delay
™g.° homber, 1 otupple
In. Python dictonangies 0 elements a@ Unordood, $0 jeu con
Acces edema clemedts as pen Specfic orden.
Dickonascies ave vn-osdened set gf elements , So the printed
ovden | element Vw not Ame as G orden You whered Ho
Clements ‘in ik -
You might also like
,,,,,,,,,,,,,,,,python.p NP
,,,,,,,,,,,,,,,,python.p NP
154 pages