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
Qi
Ans,
Qa.
Avs
@
Piqua Kumar
Assignment ~_) meaeensen
Why We Use Low Ih Python Pane Lohat is advante
eh loops? “ee
Loops axe importest ih python od Mey help to
Cxe ceete a block ef code depead edly.
Ndvawtages
T) Pewides code reosebi lity
ip We do nat Waite code againkagain
Dibbenentiase between Jor and while loop. |
For loop while loop |
i) TES used Ao Henere
Oven a Sequence Gly
me.
Et iS Used to ve peated |y
execute ca black cefy Statement
ushtle Conditien is youve.
ip Ued when ho. og
7 Used when ho. sLttescacHen
Trenate 1S known.
18 uwencusn.
Write a python Program for hous Yo check Theo
Aven number is Hibenaci number -
Ye int input CM Enten the number” ))
°
\
\
0
apo
wl
h==O otn==)t
print (tyes)
a
&
e.
usmle C
Corsi nve
pmrt(c)
Cukpur= OVE“ E
QS. WAP fo print the number pore Uden provided
Pind Stasue = ik Linpud CS Erten the stosd of verge 2")
end = ine Linpust (“ Erdem He End of vornge ory)
or porn ih rang (Sto ;end+l)
put (rum )Ais
Avs,
ze
How con pou Padenrze the ittm eGo List in
Place in Python 7
Pondemize a List using Random
Shupite O) 1s mest 7ecormmended Method Fo Shu gpl ov
dist
Prive partenn
Hz
how 7 in vonge Un):
HOw J In Tange (yt
print (o¥) end= ay
prove ( ny
for Cn range (4) 01-1)
Yor Jin range Ci) ~
Priv (6%? ends")
pater (>)
LOR-P +o display di bonucci Sequence bOoF yenms-
Wrens = int Linpur How many Ferns 22D)
nl,n2,=0,!
Couns = O
if nterym <= O
prive ( Erker te numben”)
eli ntesmesl:
prirtinl)
ese 2
print UO Fibenacci Seqvence™)
wake le (gunk
Wlend
Wd = nth
Cent += |QS Explain elit: Stetement in Oytron,
Pod “Ely? stunds ber Selte ipland ic
Programnang re FORA MWK PIE Condi Herd. LEIS
tlomitlen fellowing Gh ib Stabern Gat to Ged ay
abtenhative Conditen ib tne test com date.
alse, The code block unde the elif
usill he executed only YE iS Camditen is ue
Qlo Explain all Conds tenet statement in python
Using Smo Code example.
Pr loncditionat staxements ane —
Ty Tp Stakement - De alow +o execute o blood fy
Cod @ ipa Contain cenditen 1S ywe.
€Qg- Hes
Ty numPe?
privet the number is pesinve")
VY} else Statement Tt atiows to execud® a diYEMErS
plea eh code ih the Th Condi tien IS 4alse,
= hes
ip remo:
punt(“ the numbea is positive”)
else?
painr(- mre numben is negodive.)
jy elily Statement — The elit. State ment aUeusy se
do Checle Cxecutive dipwerende code blocks
depending on ushich cenditicn is trve
eg.= NaS
Ip num>o >
print “Reaitive umber”)
eb nom <0 7
prive ('6 Negative num bes”)
else >
pant Cine number is Zeno" y