Page 116 - Information_Practice_Fliipbook_Class11
P. 116

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.


        5.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.



        5.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

        5.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)


                                            Figl5.3:lFaowldingrneloflnnlifltSnStetnS

          102  Touchpad Informatics Practices-XI
   111   112   113   114   115   116   117   118   119   120   121