Page 114 - Touchpad_Plus_V3.2_Class 6
P. 114

Program 2: To perform all the assignment operators.

                                                              Program2.py
                    File  Edit  Format   Run   Options   Window    Help

                    #Program to perform Assignment Operators
                    a = 21
                    b = 10
                    c = 0
                    c = a + b
                    print (c)
                    c +=a
                    print (c)
                    c -=a
                    print (c)
                    c *=a
                    print (c)
                    c /=a
                    print (c)
                    c=2
                    c %=a
                    print (c)
                    c **=a
                    print (c)
                    c //=a



                  The output of the above program is:

                                                                 Output
                    31
                    52
                    31
                    651
                    31.0
                    2
                    2097152



                  Logical Operators

                  Logical operators are used to evaluate conditions and make decisions on the basis of results.
                  They are used on conditional statements and return either True or False. Python supports the

                  following logical operators:










               112      Plus (Ver. 3.2)-VI
   109   110   111   112   113   114   115   116   117   118   119