0% found this document useful (0 votes)
7 views7 pages

Looping in Python

The document provides an overview of loops in Python, including while loops and nested loops, with examples demonstrating their usage. It also covers conditional statements, user input, and basic arithmetic operations. Additionally, it includes examples of checking for even or odd numbers and creating lists of movies.

Uploaded by

harshagaur20
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
0% found this document useful (0 votes)
7 views7 pages

Looping in Python

The document provides an overview of loops in Python, including while loops and nested loops, with examples demonstrating their usage. It also covers conditional statements, user input, and basic arithmetic operations. Additionally, it includes examples of checking for even or odd numbers and creating lists of movies.

Uploaded by

harshagaur20
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
Loops ‘in Python Soop ose usedl te sa peat instouction. —> while teop= caile Ccondikion): H# Zgome exs aa hile a>o: . pint (Hello, a) a=a-3 point (“loop oven) ex- az=llo @hile a>i00: -fosr. (co odihen)! H some csoail. {£=0,2,3,47 ox se Fad Clnothing)) xs fan i im oange (in) if i 3==0 pint (0) EN ad (1 Nol hued!) or > Nestled Loop stad emend : ePe frat in onge (ue): > +, ore fa jin Konge (ai): tow oP point (%?, end-”) kee ® Spe ntl) wate sf. os s tre es on 5 > tee 2r & in songe 5,8): we * . paint (fs! pend =?) aad se paint C) Sao The Jump Shabirrend + pe Boaak xX ee ~~ a8 a Basak + It enables O Plogeuare ts ckip oven a progeom. s eee Le Liy2r3yf4d 1,2, 3 AP SSO he > aaa > paint a Ss Conbrw> It -feocar We next tifiation QB the Doop bo tale a = place cd ex. Le L123 @AI S> 12, 3,—94 fon iia d: if (<= Contin paint Ci) elanands whallen if is tun ov fhe. D> 642437 4 + I+ pass all te ATT = Sere Vuh £ Sidhe for poker: Gast Lbile & program teinpd 2 numbers 8 pain thor aoe: wm = ind Cinped (“ein Rast rurnben:")) tum? = int Cinpud (“ erin Second mmben:”)) ctl oe Fr int (The cum § "yaunstend?y mts" soe) tS Gas. loite © paoguam 49 inpud ich Go squase £ purl ils ooua aie & cide = int Cinp dorky sid Q sqpane s") cae than = side cide EP Pritt (than YP cease Roving side", sid," 15%, dun) “TE Ss 2 ux ldsite © program te inpd tse Flabing paid ruaber & paind Thain = > > ¢ runt = Pld Cinpal ("extn Feat uber!) air nun? = leak Cinpul (etn Sead) ranbes!) alli 4 Avy = (Pema +00 2)/2 4% > Print (tag BY nv, © and! nvm2 "is", Avg) “ie ust (ache te inpd 2int no yb # Bint true fox O eeia eee "wae numt = int Cinpd (“erin Post rurnbent)) oie> turn? = iat Cinput (“ enlin Second usrben. :¥)) a“ if num! d= nem?! Tite? pied ( Tous") «Nar che; ‘ery sjai10) (aaRend (fake) “iw Gui5 Wap ts inpd user's Past nano sf piel 7 ik orth, Nama = inpud (eile spore none) Yo pried (7 Long B your name is, len(nams) ) w~ Bus Wapte HM the occasunce B $ ina Sty. Slee “Hip $I omtha ¥ symbol Fossagu paint (ste. count“ $1) ) um Wap te check ifr ruber obinell by the user is od) oxenen num =id(lopub (" erin asttiahon ")) if tum %2==0: paint C1 the number is even") \e ebe ; paiad ( tha number is od") Wap te check if anunber is orudbiple BF ov not « nom = iat Ciaped (verter a number :")) i om LF ==0° ” if orea sha wunben is rulyle 7 ) TERS er rrr rr ry E \ an ‘ant Che nanber is nak eradhple B29 Wap to ark the use + ota names & thas ZPvesile moive 2 ater Thorn ira list: gas (chin 4st movie: ”) mov | = mov 2 = inpul (ted In movie ”) tov 3 = inpud (Yerhn 3rd) movie ”) novi es - append Grow!) W224 append Cmov2) e \ pievins append Cov3) point (movies) PUBVEEEEEELELEULEE Lop ts Ak if a ist combing a pabndawne

You might also like