0% found this document useful (0 votes)
22 views

Conditionals - Boolean Values, Operators, If, If-Else, If-Elif-Else

Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
22 views

Conditionals - Boolean Values, Operators, If, If-Else, If-Elif-Else

Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 13
Umt-3. ¢ Corthal flo {neltons ond Ss @ | Cond Renal © Boolean \faluws and OPssafors, Cond? anal ry Peet Capt) 5 cholnad Condt tral CH eli}- else) Conditionals Boolean | \Vrolues . & Boolean Valu are True O% Folu - K Conditions seta “Maur Ot False - #-Opsrator tala ‘Wo \tolus 4 01 0- | y>> to==l0 yp aslo | Tue yp b-50 [>> to = = 20 arb | Folse False y>> True + Tout y~pach oe True >>> Taw k Faloe e>type Craue) Sy Teun - Teua clas" ooal’> 0 > type CFales) jer oF Tae A class’ bool! > 5 >> type Chae) b> oF Fale Tradhock Croat stant Call \oat) : 1c File “2 Qhdimy’, lire t, to < roduley | Nowy Error! naroe’ bwue! bs not deftrad - ‘Dacsaien Making Gtaturarl aN x Dectatn “Making ts The anttatpation o\; Conds Hons Dceusing during ths executin of O pegian and Spactfi actions, taken according te the Condi tans . Feu have The con fan a4 a type | dee am ce ilhan asduras NnOM- Aero Qnd nen- null Valu os Tauty and Zeno ow Tull Value’ os Farge Valw- Al Conditrart J ce 1)... alee Chotned 3H : ath. alse Neated yee alse Tolne ‘} © mq 1: The genonal ae Ee Ye dockeion ea ¢ B used fo tut o Condt rons 4 The Sue Haters inside iy wil bo,erocut Adtemed Conditional Cr condita Ss beue a tL Ceondt ten): totems 1 Stodemont 1 Staternents - outgrde ~ h Problem . ees « Peoganm fo Provide dP Seat of, Re. 500: 1 the purchou araount fe ae Afian 2000 - Passchone 7 C Puichan >= 2000) Puachoae = Pun chose - 500 Paint CS araut to ae Purchare) > tot Cinput C*anles yous Purchone aro gut ")) Output ants Your Purchase amount Agoo arama 4° Pay AZo0 - | Pay oe Provide bonus rook of 5 af “the al b Sports. Contin Yous Mak out of too')) m= tnt (input . c= Toput Chanter Yours Costegory ale.') CC AD) os Cc=2@/)): me OS Paint Craik!) output ans Yas mak ow af) loo oT ony Your category als . 3 }monk be 2 Bitenakve DheCUA Ve Nees @ Twos branchws 4 execution! 3h block and the block candttion Ss teut Ahotomortts Inside The ih eT the * posit ges axeuilid - Opt poet olfiaxine els tL Ceondttron 4): | Problem 3 Wak 3 ie to chock The hegahve aun nurbor & postive ¢ a= imtC Topat Center tnt Value") | 1}, Cars °): Pant C° Posttive number") alee : Paint C Ney nuraloes”) output Ents rt \ealue 25° Post hve Number - Ente mnt \falue —5) Negobive number - A-| Wah o ie to check the ae number f odd ox & a= int Cinput C “Ents mt Value") TL Carve a==0): Patt (“Even durober”) ele: Pant C° edd number”) output Enis tnt Value do Even numbes enh mt Value i odd number 5. Wak oO Proguom se chuck The jor not - que Yeos Nop oe Q= tat Crnput C“ Ents ant Value") a] Caves ==0): Print © Leap Yeon") Jalse « Pant C* Net Leap Yeost") | Ou nee tH vroluz 2020 JLeap Year lent ant Value aoal Not be op Naor = | Wate 0 Dee ts . | to sage! to check the pecs & eligible fox Volk Oge= mil twput (" Erker yous age") t\ Cage >= \a): eas C * ligne {ps \rote") Q\be Pant (° Not ie Ona Entir Yor og. aS Eltgtble os \rote Entry Your age It Not ote is \eole i Vote") check ‘the qe Bai tuo Nurnlarsa - ut C’ Ents oO Value")) a= tnt Cinp eran Gopat c"enhe b Value’) i, Ca>b): Punt C = Grseoctent”, a) alse: Paint C* Cyseotct”, b) output Erviy o Volw 10 Enty b Value 2° | Crseatint ao 4 The alr}, Sp Short toe who % & This & Uaed to Check rnore Man TL the Condition 4 G False, st Candtit on 2 oly the xii bled oy Ove Faber: tran T one Cond?tm. 1} Coonan 4): Solved 1 checks ‘the alr} Ctandttion ad: all tre Condit Sia en tv grocutid- en} (eanattion 2) Os pot Staboent 3 ere Ahe Sexual \ : aly oly Pp soa er Only cw por! fe axecited according aie? = to “The Condit on . ane The 1} Hook Cox have Orly Wocke, Bees have eovulliple ale blo alse Ce Problem - ( Wak oa ogee fo check The Fram Seay Syste monk = Trt Croput C* antes yo rmank -")) 1}, (now k >24n: Pant C“gsade : 0") alt Crmask >= 8: Pant C*gxade : ot") alt} Croask >= sty? Pant Coqrode: 8") ale) Crmosk >= 61): Paint C° grade « an alt| C rnonk > = 50): Print C’ grade : B”) reas _ Paint C* ee ~-RA’) ‘Outpa ane Yous Mok! 5 Qpode 26 onby Yor mork: 1 gad: 8 ants Yous mawk: 50 Ha ne lalate Oc Progam te chock The Teale eal F Coleus = Yput C* arity Coloust se drab rc len2") 1) Ccolous ene qyseert!) = Y Patnt C Gro") ali}, Ceolous == * Yellow"): D ant C°GET REBBY") jain: | Pant (“sro PY) S oulpah @Q ile calour of, beofje led: quan Go ontiy colous of twopkt LED. Yellow GET RE By. b wtb untir — Calowr 4, Saf fe Led: wed SToP Wak o ree tb Cora pan. agualtty hb tuo nutmbe x = tut Cloput (antes x Value :")) y= tot Cimpat C*antix ¥ Value :")) 1 Cx==¥): pant Cx and ¥ Oot aqua") alt, CAAY): Paant Cx Te Lins thon Y’) alse: pant Cx & epoattn than”) utp uitiv x Value: 10 antes Y value: 10 X and Y ave qual. gil % Value: too arty Y Valte. Aco x B lw. Thany lonty % Nala: aso antes Y Vol: 1a> xb 7 han y. - lalate 0 ram te The Rests of, quadxatic squat on. O= ‘ot Cropat cs enix & Values") b= tnt CFnpst Ctantix bb Value :")) c= mt Comput (grits ¢ Valu :")) d- (ib -4* 0%) TC sa Part C° zocks ant Gore Gnd Heol") als) (Aro): Pant C dh \padt sual zools”) dine: Punt C Fre aginay soos") ook gone o Nolue : | nay eS conte ¢ Nalw. | woot, an Some ond wal ane o Value: | ontir b Value: 3 ontes ¢ Valu. | di} jourd seal Boots onli oO \eolu. | entry b Value, > ant ¢ Value 3 4 coo omy sooth | Naated ‘ = 1) One Candtttcral can also ba nedid wrtthin another. As numb of Condt fica Can be nested Profde cra Onotfo - aa Conditim ts trae ck cheeks onto Candtiim 4 a beth The Condtitas Ore fave Shatorord / dotunent 2 gyeculed - 1) the Conds ftw orecutid olfwwine S = xteuitid b fo le Qhotoraertt vi eeeahm th Ctenathon 4): Gobo 4 Be: Statement 2 a alae * thotunent 3 Problem - Walt o Pp Jo cheek Bigged Grama Thee nwunboe - as intC tn at C° ont the Voluo of a") be tt Cimpat centr The vale of 6) c= tnt Cinpak Cc antir the Value oh c’)) th Cab): ee : Paint C'the = ets» 0) else: Point C° the ~ no b', C) dle - 7 Cero: ia b pant Othe qquatst We 6) Q\ na: Print C* the eo no b," 0) Output, \ ants “the Value oh a 320 ants ‘the Valu of b 20 ante ‘tte \alw che 1 the eae no f& Ao Wsth o progtors to check “the ne tt Comput (" arti, The Volw of 02") " (Gi==0).: Pant C the nuroloe ts Zor”) ee number & Ze, He 03, -V! g\baz a} Care): Prot C’the numkes b Posthive") Q\ne! ; Paint C“the number pe pub onter ‘The Valw of, ns 0 the numloes is Xero ane “tie Value of 9: (oo the number b Poathve antes The Value ope. -= the numbes bb ee Toliw 1 ¥Ain onltee }, Aolenwt bw oO Giaphie {pero ohh Glateraent ond Y Mow Can\ventunts i, wr teed to pelos Siropla took Suntan: do taak A } Condtiim ‘is tee slat do tosk B D> A=20 > b=40 ae i de> paint CY Biggest’, b) rcbra) ake print Brggest 1) 0) Brgest 40 >» a=bo : : cpt”) ye paint C Biggest 1» 1 Choad ela print C Brgqes ac Baggus bo

You might also like