Page 106 - Code Craft Computer-7
P. 106

Syntax:
            if (Test Expression) :

                 Indented statement block
            # if block ends here








                                                   False
                           Test Expression
                                                                              Extra Bytes
                                                                              In  Python,  the  non-zero  value  is
                                     True                                     interpreted as true. None and 0 are
                                                                              interpreted as false.
                              Body of if




                      Statement just below if






               Program 1: To check whether a given number is positive






















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
























                                                                106
   101   102   103   104   105   106   107   108   109   110   111