0% found this document useful (0 votes)
4 views25 pages

Python Conditional Statements Guide

Uploaded by

tricksteryt41
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)
4 views25 pages

Python Conditional Statements Guide

Uploaded by

tricksteryt41
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

Py1hO'Y) r~.

3ve1mm,n~
f:i c.c.. - 3 o 2-

l>r-At- - II~ f, 1'fhon


1
~~ (tew C.0-,--,h-ol ~rir:JJ.b~r,oJ t.,l.11,x..c.

I• ·,r I e r.s _,_ a-n d eJ.u~ ·, F ( ~ ()


.1 • ~ i ""PU. for l<, 0 fC U) PY'h<tn '
-3 • ft,y- Lo() r l,t.!, i~ '"r"c! e..t I lie t- 0-A<=I
4 · U.1~ of [Link]. .too~~ U) py--lh<m .

.t· loor 'YnO-n1'puic,.hCJY1 u~i"j p~s I lon fm~ 1 &-rea t


~ eke.,

C, . rJ"""'l'rm:J lJJ:~ PYfflcrn Co<ndihonc:J as.J Loof,


btoc.t.s.

[Link] : &-Tech
&.cm~ : C... 5 2. E ~ tr
n
f [Link]')0n ._.,:i\fT~ t , , ,,:,~t "U <·.-.,,/wl (, .-.,..,~ '" t..-, pt•qt ·/t),, t
C.i;:"-f) b... t',,t 1.'."c1°"'f~ \t f"\ ' t""-" f"'\].,H" \.~ . t\foll1, ,1tfy , l•, ,,

f\Yiht'\) r~..,.. . ~n ) , • '" C --~ f ll k nwntc ,n (' {' )t I'".: rih.1tly


t' CH'f ""· ' ~ t\h

1'0'1'\) -~or ~t'-~ bofh.'tl) , ti) •h,r '"", i~ ll) ""h'\'" lt,t-y ,,rr""n·

r""' ult~ w1't"r~ uu """'"''' J -lo C-'lt ('tu t~. tl .•!\.' t ~ (. fr\lff'rl"n,..

ba.!~4 on ~o-n"\L C O"'(") <-ti. h~ ~ _!_: "- ~ u. r, h <\ ,


4
( o-nJ"'~ •fco. .. ,
~ot k unpli. mentd •

~ ~~ 0 { ~--1-a f em en t- h~ ~ 6 e ., -x [Link] ~ \ / cm\ )' ; (

a UYnc:fih'o-n ~ 1-n.t.e.. E~~ \t .S [Link] t~ .a:Jrp~d or -

a "ho 1n e-Y ~ e.t- tj ~fd t e.m <U),,.. ~G ~ -+--o h(l. ~ --x e. tu.1 -e ~
1-
~ i..t c..c. (f ed d e. c.J.. .l: i ~ Co1'\ h-o/ -P-~ -$.1-t1 temer,t~ .

**
I~,
IT .STATEMe::1--JT
. _r
'T i.s a ~ ~;mpfe. tv)~t-hocl of c..h ~c.~ 7or
tondth ans · WhEU1 w-e. {fv-Q O c..cod,'h an of+e-r ➔ he. ~~w~J
\r-U"\'.~~cJ oT>d if ,1- ,·s; +rue i±
1
if' .-r-h~ c:..o-ndih'oY) is
e ')(_ e tut-e a -s= e..t- <t( .s.-16-f e.m ~r V) -th e. bo.1 'f 0 f if -
.Siotem ent ·
e
~~~ Flow [Link]"Tt

tloc.t. of
.St·d f-eme.l) t~
if e.)( r ~ ;OT):
..Si Cl 1 eml'J)1 1.

~ ~ For r1
q = Int ( ;'Y1Fu1- ( '' tJ1t er a ''))
;f a > 100 :

p-ri'Tlt ( r, 11,e numl,e.,,. is a-red t- e-r ,t¾Jo.,, 10 0 ,, )

** TF ELS£ 01ATEMEN,S
Tf -the. co-ncf ,·hO'l') '4 !"Y'u e... 1 en e _g cu- of «. nd-.-1J t.h' e--n.s a "rt-
e."X... e.t..u:t ~ if ct
I .I.&. Fa kae. I O"noihe'r' ..se.J- of ._5;-fa-femef')t-

<l"rt.. e:x.. [Link].t ed •

Fake.

&1oc.t- of Bio~ of
'"5tc,t~+z ..£+af-emer)ts.

)( }( )( ~ Y'">kl:><

if e~.c.c iefr) :
...Siq-f e.N')e.t) t- J..
cus.e..:
...S f··ed·ern er) ~ l.
~7< r~ . . ~ ®
"Y'\ u,.IY) ::.. - 1 O

1-f rl')U m °'> := 0 :

mm~(, ~t· ,~ po,ihv~ trurrJ:JC?r OY z.e.,ro '0


e~o. :
pn'r'I t ( ~ ) ~ ·u a ...,,cr'1ve rn....,,.J, er ':)

-~- Ne, ➔ W-1\P ~fo [Link].J:. [Link]~ o.n eJ1~rc.d Y>o


', s ~ e--,- '"'Ylot-·

'l)(JJy)~y =- i'nt ( l'Ylpot ( enter


11
a '"'nu..ml,ey- 1)
;f (~ e y ;. 1 == =~
p-n-n r ( '' -A-n- ~ 71 UJ)")h e. -r I
J
(!'-'.e :
p-o-n ,-( ,, -A--n- ~ "[Link] ey )

** IF ELrF E lsE Sf"ATEMENT

'f e 1tf el~ e. -s:: +ate,n el),-: , m o '\-e --+nan oY) e Oo'n dJ. nem CA.O

k o..d.t.f,.......vcaJ U> ~ .

if ert!'~ionL:
~ement- 1.
eJif e-x~iOYl 1.:

...s➔ crf(!,n ent- ')..


i P.>roc.t.. of
; ~--t,"Tirme..nts. und~ Fa~e.
: t Conjj ti CY')

I
-ri-ue..

Bio c.x of
So-fe,nel")tt. Ul\d~
e1...if

f>loc.t.._ of
.,___ _ _~ ~+at-em el') t:s ~ey

Co-tld; fio-na./ .st<l~en-fs.

½, am No ➔ WAI' -to p-n-n r- -#i e_ ,yru'~ of ~ ·


, Ma'ru ~Q_

q, - loo ~

~I - Clo e,
71 - So c...
GI - ,o b

S-1 - Go E
<-= so F
p'OY'\t. ( 11£rrLcr 'Yn <lT b:. of .C.1 v <luff Ul ~ ~ ~ '° 'J n/sJ
''

'YY)(')T
ind
k.- 1 :;;..
i,rc·•t,, ~
( f) f t"Y' 'N I ut.
II )1'
')

rrna~l - ')_ 7: •~l (mrut ( ' r,W."t V ([Link] . .Q.. "'j)


f)')'') l t) t-~ ~ h ,t (i'Tlptt ( '' tnf ('.'r v ... l.A.a.t_ ' »
1

~o-. t .. 4 :::. hi t . ( t'T1p1t ('' f ntt: v afu.~ ''))


11
''W)O"rl - ~ = int (~ut( '1 6-}t-<:'Y volt..u ))

to t ~ ':;.. h'>a-r t:- t + .mm t.-. ::i. t- mer,- t _3 + rrKTr ~ - "'- + ,,..~ t_ i:-

°'1] =-- ·fotat/ ~


"if ~ >= 91 o..ruf Q <-= 10 0 :

pn-n ,- (''A,,) I
ci.i-f Q >: SI ~ °"'1 < ~ ~o :
f'O"O r ( '' S')
€Ujf- ~ ";>:: 71 ~ 7 <:=- &o :
.
f1YYYlt- (c_')
~+ ~ > ::bl a.-"-4 ac:::.~,o:

• rn-rn t- ( ,, D 'j
I
Q <:: bO :

rue . 1

p-rm,- ( ,, GrnJ e u F '')


rm1t- ( '' frtiu4 '1
~ N e..sted if eJ-'e.
if ~~ ct if ,~ c_pflQ._q hes:.:kq rf.
)( ')( * r,o w [Link]...-t

take.

~'fqf eme.t)t 3

Fal~e

~ * -Fer~

a "" int-(inpu:t ( 11 tnh:•-r --lt,e "[Link]-.- j)


if a '> :::: , oo :
if a;. 1-. == ==- o ~
prtr\1- ( ~ Nwnbev- ,:rater ./tiori loo o..nJ l..t [Link]-,_j
e'-'~:
f"M)t-( .t Numl,P"-r [Link]--- --/tit1J'} 100 o.,vJ U odd~
e..lse:
~r (~ NUl'll 6 er /e..ci:: ../n<V) 100 '.'.)
____ _____
. NO 0 1. .
· ruTO~I:f\L

~ E ,<pkt t'n VO , ·iou~ C.oY1dih'oroD .s-,af eme.n i~ tn p'y1hO't, .

W- t'",(pl1.'-in ·th~'!. ~ yn,ax cf if e~r eue (A•. u'·1h ~•Mru.


('')C "'""PL,. ~o.--is~ t:n py~,-.,.,Y>,

fil C...,-.-nrxr-. ~ tUe. of , if , i( - el~e 0-.r\ cJ ;f- el.i( el.i e.


(n pyihon .

E.l+ WAP lJ) py!n~ -t-o e,iter a(je. and p-ri-,,t- if --lhe. •

r"'OV\ u. [Link] --for VQ"'B'


~ 'NAP V) py~ho.,, --k> f,,.d lo'Jes.t-- of --1~ 'YlUJ\'lhen
Qoi~Q b1 --the ~c""·

~b WAP +o ,ead -....Jt-ie "numhe...-. of do'I . ( I -tu ,)


C\J"\ q clicp lt1_J ➔ he ~c:1 "rne. of day ~ 1 -fo..,. .S. [Link] o. y,
:l- +,-r ~CY)day -eh.•

a,h =- fo,:i.s ~g f+nd bl.4.1-p~


~d X =O
i( a+b:
0-= 0
0~
pm,~ ( ',-n...e. ') b :: -..t'
~,~Q..: if a>o:
p-,-r, ~ ( 'fu lse) if ~ < 0 :

X = ><+(,
,e.f,f O>~ .'

'){ = X +7
[Link]. ~
X-= x+g
[Link] :
)( :::.. X +4-
~,- (~)
6)
J:l€-r~CW"I 0.....- !oor ~,,.,., e.i lo g; f ua h
0

0'l'1 W "'ere. .ftve

~a..N"\e ~le.. hM ~l o b.A- ...,,..~~k'..t/ ~ ~~ ~e.t- ~


t'.n.11-Tutl')CTl"'I'- ~~ .. tn bL C"k.t..Lu..ttJ ~ , _,._nt..,, ~_d'J I eit>, e-r

.sru.t.f't. [Link] 0 -r o f •li'm"'J. o·, [Link]>H I Q f &A-y+:,c...v.b"'r U1'Y')C}1'nm,

ll.. ~ "-~f;~J ny "T1 ol '

;J(~ \~HI LE ..£Tl\i £ M CN T~

~ ,- i..l rt Gm. pU. rn eJtiocl o{ 'tmp Iu-n enn'"'Q ~atm-,


""'.-"1
DY Lo ors . We.. Q' ~ a.. ~-rid i hon af+r:-r . ,_, e. ~~y w oYC./ ~
1
wh,,;u. 1
, ~o ....,har-- '"ihe. Ca-ndiffrm i.c ve.n~·ec/ ~ if i.t- ; ~

-tru e , i.t ex e [Link] ~ e ~ el- of ..s+o~rn e...r, r U) 4-n e bod 'I


of ..Joe.. Loop .

~~ Flow c..hort

Fa~Q.

..Sfatt!.IV'\C?.r) ,-
a~ ..... Loor
.s~[Link])~u
*4{~ _!,ynto.y.
whi u. ~~pTl9~ ion :
~ tat emcl) t L

i= 1 ..
p"rn"I t ( _P-nmncJ -nu.m b=...i: '1 +o '' , 'n)
wf-nk •<= h :

p-n~ t- ( i)
; = i +I

6l . w AP +o p-m, t- ~ [Link] ea: '


i() put- I')

\J-)j ~ ' <. =- r')


I
.
·

''f .1/:1..-= : Q '.


~t-U)
. .
I= l·t-1

~ , WAP +o ¾d . ,_,., e.. -5! urn of 'Y'\ - ,.., [Link] er.s. .


i""pu.t n
~[Link] = o -:ff:! iYliho.L~C7Tl .
i=I
\Nl--n l.t. i ~ =.n :
..5u.m == ~ U,./'r) +i
• i = i t-1 • =If= t ~ t... [Link]')I~
~ P'n.~J'Y'(\rn-' ,,..., wh,t. loor....
fJ. • kl A r ·t ?' '"l ·t> V'4' .-~· (' (1 "l l ll)1 b~' r .
hum .:: u 34s;
lf€'\/ ,:;-- 0

\.',} h I l' t "'l l lff) > ('I


c~'f ~ . . . nu,n / ro
") ev :;-, ")· f•V ~ /0+ cL . 'v,t"
··f,un"' /I . .,_ Io
r )'''Y'\ t- { ,, tn..L ')·-c ~ ~ e ..,.., (. [Link] b ~ t'
,,
, ~v)

&. WI\P +o chect:.. e.n~r-ecl nu,y,be r u;; f°/.,-,..,dyc,rne or


--not- -
1f(!) :1'l..1.

ie""f = "num
,ev:: o
W h1 l.J. num > o :
d,(j'~ : . ""l)um '/. ro
-yev :: ~v ~ 10 +cl
mum//= lo
if ~ -""'P c ::: oe" :
p-ymt- ( " [Link]~ :)f
el~e :
f"Yl r ( ')No,- pa..G YldYll -rfle. ")
Q WAP 70 ~cf fact-o-n·n.f of a nHtrh~r.
,iun,== ~

fac.J- = J.
whit... num >o ~

fa CJ- : {ou- -~ num

-n um :. "1um - I

rn,-nt- t' rau~cJ i~ ·,)


.f•c.t-
a. WAP -to c..oun f- ~ .,. CJ) a ~U-f"Y'lhPr .
cf
,, u rY\ :: i .1.3 + S"7g<1

Co [Link] t ":: 0

wm·l.4 Tlllm )0 '.

CAlltn t !" Co u-n ► • I


~ltm // -: /0

pnr. t ( ''Tol cJ c-J_,,.. 1 ., f~ '


I/
CO<.mt-)
'
Q w" P ~ o ch ~ c.l:. w h (>in e,.. en t (!!,... - . , \..VY) 6(,, ..- ,~
()-(- 'r'>Ot •

No re .. -!u.m 1 wi>~ °t ~ u
"Oum = I ~ 3
~ r c:; -[Link]
..Su.m- " o) = 0
W 1--n u. -n u..rn >0 ;

~t ~ ~LL-m /. ,o
~UM- vo..l =- ..St..u-n -Vo.I + d......rl ?f?t 3
'Y'\ u.m // = Io
if l ernp = =- ....s [Link]\- v ~ :

pnnl- ( ~ ~ J 'J
el.c..o :
F'"'1" (" Not; a-,y-,,shoj _:)

6 . WAP '"to pm,,-. ~'bonocc..c ~~u t>fhl -n -kr,n.s .


"Y) .:= IO
a, b -= o, ,
loU'Ylt- -::: 0

w h,:, tJ. [Link] <. i, :

p-n-nt- ( 0 )

~p = a +-b
a -=- b
h =- ~.mp
[Link]\t-- c. Cou'lt +- I
*~ -Fo--,,- loop S f-o t,em e,,tl; {j)
-'t- u Q l.s.o -','m:la"r to w~lt. l«p [Link]<J ,·~ ~ x f.'(uJ-oj ~l,1ny
.Ji~.

~ ~ Flow UlCJYt;
[rit<"T\~
•fo,-, k,op

~tateroent- ~""
-fer ~ ~~ ~ - - - - . J
-~t-

• -for vo'ri®LL- nam~ in~·st--_ no~e •



body of loop .
~~ -Fo--r~
h -::: int- { input- ( '' [Link] Lou'Y'\t'- '' J)
..[Link] =- 0
.fer i ~~ {--r,):
·v
l/)

vo.l r. ;Y\t (";v,rut (" En~~ -nv..mb~r


!,.um .:: _!l.V\"'\-+ vd{
-'/t-'1(- ~ e () Fur,cJ-,'on i.,,@
~+ u a h u.i ~ -fu..n U1aY> Ln py#>an
tr) -fhoJ- <A u~ ~"fer
[Link] ~ th for ene-ra:HG Q ~ 9
O
(5Y) , u.Q.I)CQ_ .

,S'/NfAY


D/p
j_

+
l
*P -ro,-:ams om -{-o"r loC'I p
& , \NAP -lo ~~ '[Link] C'r~ r-fyurn /l:1 -to I ,

-ftrr t l/) 'Yrl"jt. ( f O 1 0, - ,) :

pm"' t ( i)

~. w"P -to C..ou11t,- .. fh c [Link]"'r of Vovvol.s.. in Q ~ {n-r-,J


U~inj •f c,y- loQp ,
~ ~ ' ~
~ c: py~noYl Fj-ra~
C...Ount- e o
{-o-,- c.h V)~ !
if c.h , to~() (.I"') '" a ei ot/' :
(;O (J'l)t- .:=. Gou'Y>t +I
p-tn,t- (~ No ot v ~ ,
.
,, ,
[Link])

Q . W Pt p -to pnrr a II ')')u..trl,er~ b e t ~ I t:1.1\.4 I oe wlv, ch


o..u cL.u .- r, b LL by 3 '7VV'4 s- ·
-f-- ·, lr\ 'Ya.A<'.le. (I 1 101) :

if i/. ~ = = 0 ~ ·, /. ~ :::. = 0 ;

p-nnt- {;, [Link] ~ ,, ")


®

·n,-(" hTr ,1 ~. ~ f_Ofr'r"'""' U ,,,,,,, - , ~, p•, i t· .. r,.rr,r, · It')(!,_

h1<f tn)n'H' ci att.1r'J n ·n,J •f rr .11\...t• ( ,.. , , • H,f' t,rr·,t ~A 'tJ


('"1(Huhl""r\ •f u · lh e ~ ~nh·m "-"t ju~t- af,f'...- •lhf"I.., [Link] •

[Link].

E:)c1t, -the. loop


.It f.s u .s&:# ·fo ex. e CJ.J.l e.. fmn -fhe sk,-r~ of -+h ~ ~ ~ ,
~ he T€ .by ij -lh e,
~ f:J ff G>~ e tu..n o-r"') Q ~ o--em cu.a
port- of ➔ne. ~f ·

Rest- of
.__-____..~.+a t-e.m el"),-
tr, I

* )( .')( ~ =a .
+-r J in " fyih O'>) Pj-ra m rnia / .'
if L ~ =-.. 0
1
' :

l.<YY) n--n LJ./l.. ;

r· 'r'\ t- (,) .
.'

r
,r ,, ,,
,n.~ p,,,<:. ..!! i <1 t , .. tnl•n t p,n <" ll <' "U'/ do r-.: ► H)l f1''"U nn,~
b chovr.( Ut: , tl (1,nv~n «''f) f • l',u. t , p ,1,!.t ~ lnk,nt1•f)~
'u ''nll l ·u no;,•d Ly t,rfr,,,-.-.,,..., / 1,-,(.,r :1
• 11 1(' -~ nnl"•l

i:i cl~{(<" t· c nt , ~ 1-,lll) C'n'HYn ,,- nf~ pot


\HI t~ lf) - fh c.

e-odc wrih -~t- S""ymb a ) .

~ ( s)·.

~
l.. NO OlfTPUT:>

NOTE -t We c..a.n ,e.~ ~~ f...,.LP 4~~ doU.


~cl~ ~
--n~ ~ ~ b-a_ o..t

~ ~ o - . : t ~ e,-d;'

* N~~ loop
loop [Link] arncr-fher loop ~ 1'.s c..atted n~~ foop •
* WAP +o jer,pyal-e ~e. [Link]) ou.l"pW ·

* 4-
"7) ':::. S"
"roe (in,
* ~
* 10V' i
** ~
~
~
**
~
*
~
... -ferj
l/)

Ul -r,r
=

(it I) !
*
~ ~
~

*
~..- (',.,,.,,, end - • ')
~ ~
P"'"" t- ( )

* ~ i (I) ~O'VljC.("1)~
-f-,- j in ~ e , ( i+I, h) :
prvn ~ ( ,, ~ ,, t Q/l d :. II ")
fil w~f -to p~t'" "Y"\l17"'1br-,-" tn ~)( ~ ·fo r,·f"YJ.i. ,
I) ~
,, S' (_.
., g '1

'[Link] .:;_ t

~'ty- .. U'\ 'r<•oe.. c3' =

.r~J· V) "YU./\qe.. ( ~) :
pTmt ( [Link] , CJ")d ~ ,. '')
to un t :; w VI),. +- t

rn't { )

@- \"\/AP -to print ,,,..


'* / '-8,
**~
***
~**
foy i in -fOI'\je ( ~) :
~ j in ~~ e ( ~): .
p'1"l'T)~ l ,., *
'-1! , aid ~

p-nnt { )

&3 w11P +o rm.. c1h1-


0 1L ~fay -1n<11L .
~
~ )f-

~ * ~
**-it~
-f',e-v- i l/l . ~ ( 1, t) :
~ J U'I ~ (L):
rn~.. ( .t ¥- ,, , encl :: • j
p,i,,t- ( )
1
f 'l-
11. a
j 2.. 3 4-

--fov- ...,-0 (
-ra (,
j U) I, !;) :

-fo-. j in i+r) :
p-n~... (j ' end :0 • ")

p-rmt-- ()

~ NAP +o F" i.n~--4 ~-f,...,. °"'""Ou. •


*****
**
~~*
*~

-fer , V'I j e ( s:, o, -r):


+,-.- j in ~ (i):
~t-( ,, ~ ,, , ~ ~ ,, '')

pn·n~ {)
&b wltf> +o prrr,r ~ ¼.A..L-tt) ~ nUft')b~ .
I I '
1 l- .2..

3 3 .3

for i in ~ ( ,, 4):
~ j U) ~ (3):
prn,t-( i , enc:I ::: ,,, "j
,mot () .
{x 7 · W llr · I o f"'n t· ct 0. p!\o. [Link]. { -..1 '"Qt.. ·
~
A-~
lr~ L
A-e c.. ~

-fov- i i..r, -Y-....n. ~ C. ( II (;') :

..fo-< j U) o<: ( r) :

PY'"" t- ( ch.. ,. ( (i ~+-j) , ef\d ~ " ')

F"O t- c )
&~ NAP -to F',. hotrrJvv 4u.a-re ~ ·
• -X-
~
* ~ * ~

* ~

** **
Y) ~ s-
~ j l/). ~ (-n):

~ J
if
i.n
i -= 't:.
u.
o esr , -= = 'l1-r
('Y)):
err-
.
J =--=- o errJ =.. :. n-,:
p--o-n r ( ,, * 11
' [Link] e ,, ':)

e..l~e. ~ .
Fr(,, [Link] - ,, '')
p-n,nr ( )
fil ""AP +o r'""° t-
i
,. .3
+~ "
7 g '1 lo
C [Link] : 8 ,Tee ~ Bl-and) '. cs a ,T

~ u~ e (f- : htUP•'m f'yft>on f'YOJyamminj Sub Co<ie. : 8c.. C - io2..


Ve a-r : .:i. n J 'I ('ov

Turo"I A L : 03

~1 b ,s CJ.J~-' \JOYiou-' it.e-rah'c:m s-f a fernents


.
LJ') py-fhon ,

&i D--s (.tJ.S~ S y rda 'X o{ wl, i u. loop wHh ~imp:'2- ()¥ompla..
[Link] e. i.n python ,

6l?> bis. w ~s .t,,yn~o.x ot fe--r Loor w..i-lh &1-rn p\L exarnplL


lode ii) py~hCYO.

6 4- C.0-rn paye. US e. 0 F b,y ~o k O'n d C,,O'Y)+-i"Y'IU e ~ ra+eni~t- ·

Sr b--ravv ~~ e. {tow c--ho--rt- of W~l.t loop cmd ~


loop ~><pla...i..,,, -#)<!J"r Cc"Ylh--of _pavv.
Qb NY-,cf owpu..t ~
(a) ,_
fo-r .
l/) (l ,+) 3
r-v'Tl ,- (; J +
(~) 2- (d, None.

fil What- i.s ~he. outpu..t?


tb1 1.
...fo.v. ; U') ...,-~e.. { 1, ~):
3
p,mt. (i)
l'-) O (.d) None.

-
Qg WhQI-- le -h~ [Link]:I ?
fov- X Lo ~~~ {1,q,3) :
prmt (x)
(t1) c ... o"r [Link] ,, ~, ~,+ , ~, e,, 7,g

{c., L, '-1, ; I /o (dJ I 1 +1 i


fil WI\P -to
e_r,re.~ c/
fn cl ~u,y,, , ct...J' t.s ~t o -n t.v>o b er
b'/ lll ~r ·

&ro b~l~ r a. P'r*"cn Fj"'r.. m +o c:._ne.c_t e.t\tu~c:l


huMb~r i..s pol,~ch'O me t::rr -not •
Co u ""-' e : B • T(> c.h 8-vcmc.h : C..S 2t IT

Y~o:r / ..S @.m : 2.. nd/ ~-r4 -Su~ e d : Py1hon f'YOJY'ornm i'j
Sub c..ode : Bc.c.. • 3 O l.. Tu f o-nr,J No : 0 4-

~ a,b, l. = ~,to ,,~


-Sf :X = IO
a =- b
b = a
r~ (o, b, ~)
X = S-
y::. 2-
p~'"r')+ ( "X. *M '/ / -r..//y , X. -;. 'f)

~ f =- lo
ci-~ 4-
~ t ( p "> i and p < io)
Ft- ( ~t- ( P = = '°' c,y- CJ-==:! 4))

-:X. =~ 6H,
if 'X >0 : -..fov. ; i.n -r(l"t')jC. ( 3) :
pn-nt-- ( ~ Po1i h~ "')
if x.;1. '2.= =0 ~ rmt -( 111-tcLt.o 'j
p~, .. (~ ':) p-rhlt- ( ,,Wrnci j
t! l.s. e : rm~,- (' btrr\ e J
fM-r>t- ( • (SUq ")
,~ 11 '

-
Q.7 'X. = IO
y : JO

p-'1Tit-(~pe (~) , ~~(j,)


prrnt-(~~:,~ ct~~

~ aaia ~ ( I ' 2.. ' ( .3 I +) / ( S' I ") J


pm,t- ( lA.n (dot-a), da10 (:i-.J(,J, data (3J (oJ)

X = ,~
-
Qq
•f X/, a -= ::=-o a-nd --x/, ~ = =o:
p--n-nt- ( " b...v>'~!.U. by 3 O'rn.d s- ~)
-e.J if X/, 3 -== -=- o
prrnf-{ '' ~~; blL by 3 "')

els~~

,
-
~IO I == I
wmu.. i<. .t'":
p-rin t- ( ; * ,, *'~
' ,
r := I -t-1

~ fo'Y j. (/) "Y'an,r- ( 1, ") :


1f i ==a:
[Link].
p--rmt (i)

You might also like