Page 208 - Computer Science Class 11 With Functions
P. 208
ThnSlitlfoaaowtdlbylnnoShtrltuiSt,lcoepritinglnltingatltSnStetnSlnSlShtlntxSlatvtaloflindtnSnton:
print("Failed")
AlconditonnaltSnStetnSlitltxtcuStdlwhtnlnlpnrtcuanrlconditonltptcifitdlinlShtlhtndtrlcanuttlitltnttfitd.lConditonnal
tSnStetnStlnndliStrntvtltSnStetnStlnrtltxnepattloflcoepoundltSnStetnSt.lAlcoepoundltSnStetnSlhntlShtlfoaaowingl
coepontnSt:
•l Alhtndtrlcanutt,lShnSlbtgintlwiShlnlktywordlnndltndtlwiShlnlcoaon.
•l ASlShtlntxSlindtnSntonlatvta,litlnltuiStlcontittngloflontlorleortlPyShonltSnStetnSt.
In a Python program, indentation is of crucial importance. Make sure that all statements in a suite are indented at
the same level. Usually four spaces are used to write the code at next level of indentation.
9.2.3 pass Statement
InlPyShon,lShtlpassltSnStetnSlitlignortdlbylShtlinStrprtStr.lThut,liSlitlnldueeyltSnStetnS.lOfttn,liSlitluttdlSolatnvtl
nltaoSlforlShtlcodtlSolbtlfiaatdlinlanStr.l oettett,liSlitlnatoluttdlSoltiepaifylprogrnelaogiclwhtnlnolnctonlitlrtquirtdl
forlnlpnrtcuanrlconditon.
Syntax
pass
1. Identify the type of control flow for the following:
a. The set of statements are executed repeatedly.
b. The statements are executed in the same order as they are given in the program.
c. A set of statements will be executed if the given condition is True.
2. Name the following:
a. A dummy statement that is ignored by the interpreter.
b. A type of statement that has a header clause followed by a suite.
c. The character that ends a header clause.
9.3 Conditional Statements
Atl etntontdl btfort,l nl conditonnal tSnStetnSl itl nl coepoundl tSnStetnSl whtrtl Shtl progrnel flowl dtptndtl onl nl
conditonnaltxprtttion.lAlconditonnaltSnStetnSlenylnatolbtlrtftrrtdlSolntlnldecision-making statement or branching
statement.lThtrtlnrtlShrttlSypttloflconditonnaltSnStetnStlinlPyShon:
(i)lif statement
l(ii)lif-else statement
(iii)lif-elif ladder
9.3.1 if Statement
AnlifltSnStetnSlitlShtltiepattSlcoepoundltSnStetnSlShnSlSttStlnlconditon.lIflShtlconditonnaltxprtttionlyitadtlTrue
onliStltvnaunton,lShtlttqutnctlofltSnStetnStlfoaaowinglShtliflhtndtrlcanuttlitltxtcuStd.lAtletntontdlnbovt,ltuchlnl
ttqutnctlofltSnStetnStlitlcnaatdlnltuiStlorlnnlif-baock.lAaaltSnStetnStlinlnltuiStlnrtlnaigntdlnSlShtltnetlindtnSntonl
atvtalnndlnSlnlatvtalntxSlSolShtliflhtndtrlcanutt.lHowtvtr,liflShtlconditonnaltxprtttionlyitadtlFalse,lShtltuiStl
foaaowinglShtlhtndtrlitlignortdlbylShtlinStrprtStr.
206 Touchpad Computer Science-XI

