Page 182 - Computer Science Class 11 Without Functions
P. 182

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 the next level of indentation.


        8.2.3 pass Statement

        InlPyShon,lShtlpassltSnStetnSlitlignortdlbylShtlinStrprtStr.lThut,liSlitlnldueeyltSnStetnS.lOfttn,liSlitluttdlSolatnvtl
        nltaoSlforlShtlcodtlSolbtlfiaatdlinlanStr.l oettett,liSlitlnatoluttdlSoltiepaifylprogrnelaogiclwhtnlnolnctonlitlrtquirtdl
        forlnlpnrtcuanrlconditon.l
        Syntax
                   pass

                 1.  Identify the type of control flow for the following:
                    a.  The set of statements is 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.



        8.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:l
        (i)l ifltSnStetnS
        (ii)l if-elseltSnStetnS
        (iii)lif-eliflanddtr

        8.3.1 if Statement

        AnlifltSnStetnSlitlShtltiepattSlcoepoundltSnStetnSlShnSlSttStlnlconditon.lIflShtlconditonnaltxprtttionlyitadtl
        True onliStltvnaunton,lShtlttqutnctlofltSnStetnStlfoaaowinglShtliflhtndtrlcanuttlitltxtcuStd.lAtletntontdlnbovt,l
        tuchlnlttqutnctlofltSnStetnStlitlcnaatdlnltuiStlorlnnlif  baock.lAaaltSnStetnStlinlnltuiStlnrtlnaigntdlnSlShtltnetl
        indtnSntonlatvtalnndlnSlnlatvtalntxSlSolShtliflhtndtrlcanutt.lHowtvtr,liflShtlconditonnaltxprtttionlyitadtlFalse,l
        ShtltuiStlfoaaowinglShtlhtndtrlitlignortdlbylShtlinStrprtStr.





                                                   TttSl      Fnatt
                                                 Conditon


                                                      Trut

                                             tqutnctlofl SnStetnStl
                                                 (iflbaock)


                                           Figl8.3:lFaowldingrneloflnnlifltSnStetnS

         180   Touchpad Computer Science-XI
   177   178   179   180   181   182   183   184   185   186   187