Page 134 - Computer Genius Class 07
P. 134

Arithmetic Operations
                  Arithmetic Operations are used in python for performing mathematical operations on variables and
                  values. Python has 7 Arithmetic Operations.


                  Data type identifies  hat the type o  data that the declared  aria le can hold.

                       Operator           Block Based                      Meaning                       Example

                           +
                                                            Add two operands or unary plus                 x + y
                       (Addition)

                           -                                Subtract right operand from the left or
                                                                                                           x - y
                     (Subtraction)                          unary minus


                           *
                                                            Multiply two operands                          x * y
                    (Multiplication)


                           /                                Divide left operand by the right one
                                                                                                           x / y
                       (Division)                            al ays results into  oat

                           %                                Remainder of the division of left operand
                                                                                                           x % y
                       (Modulus)                            by the right (remainder of x/y)

                           **                               A type of Multiplication where a value is
                    (Exponentiation/                        multiplied with itself for a certain number    x ** y

                    Power Operator)                         of times


                  Switch to Textual Coding

                  To switch to textual code in AI Connect, follow the given steps:


                                                         1  Click on the Switch View slider placed at
                                                         top-right hand side of AI Connect window.





                                                                                                 2  Type the code in
                                                                                                right window using a
                                                                                                keyboard.















                      132    Computer Genius-VII
   129   130   131   132   133   134   135   136   137   138   139