Page 137 - TP_Pluse_V2.2_Class_7
P. 137

On running the above program, we get the following output:

                          Output                                                                     Factopedia

                       Enter the student's score: 83
                       The student's grade is: B








                                                                                                Python does not
                           Let’s BaCk-uP                                                         require braces


                        The if statement is the simplest conditional statement.                  in conditional
                        In  the if…else statement,  if the condition  evaluates  to  True,     statements which
                      the  indented block  following the  if statement  is  executed,           makes the code
                      otherwise  the indented  block  after the else statement  is                  simple.
                      executed.
                        Python allows the nested if statement.
                        The if…elif…else ladder helps us to test multiple conditions and
                      follows a top-down approach.










                                                                                                  Indentation
                                                                                                defines the body
                                                                                               of the conditional
                                                                                             statements in Python.

















                                                                                              Python's name was
                                                                                             inspired by the British
                                                                                             comedy group Monty
                                                                                                    Python.






                                                                                    Conditional Statements in Python  135
   132   133   134   135   136   137   138   139   140   141   142