Page 76 - TP_Prime_V2.2_Class7
P. 76

The syntax of the if...else statement is:

                                                                            Start





                                                                          If condition
                        Syntax                                                  True                    False
           Prime (Ver. 2.2)-VII    else:  Indented block                Statements in if        Statements in else                                                                                                                                      MORE ON PYTHON
                        if (condition):

                                                                                                  block execute
                                                                         block execute
                               Indented block








          74                                                                 Stop                                                                                                                                                                     75






















                                                         Using if...else statement

                  Program 3: To check if a student has passed the exam which requires 50 marks out of 100
                  to pass.









                                                                                                   Soft Hint


                                                                                             To stop the running
                                                                                             of an endless loop:
                                                                                             Press CTRL+C.
   71   72   73   74   75   76   77   78   79   80   81