Page 196 - Ai Book - 10
P. 196

u   Sequence: Sequence is a collection of data (mutable or non-mutable) stored under a common name. There
                are three types of data as a sequence in Python are:
                 •   String: A string is a sequence of one or more letters or characters enclosed in a single or double quotes.
                    In Python, we can create empty string by just writing empty quotes with no value and multiline string
                    using triple quotes as shown.








                 •   Lists: A list in Python is a collection of comma separated values or items within square brackets. You can
                    change or modify the values in the list i.e. it is mutable or changeable. For example:














                 •   Tuples: A tuple is a list of comma separated values. You cannot change or modify the value of a tuple
                    whenever required, i.e, it is immutable. It is not necessary that all the available elements in a list are
                    of the same data type. The comma separated values must be enclosed in parenthesis (optional, not
                    necessary). For example:









            Operators

            Operators are some special symbols that trigger the operation on data. Or we can say that operators are used to
            carry out some operations on operands.

            Arithmetic Operators
            Arithmetic operators are used to perform mathematical operations on variables and values. Arithmetic operators
            used in Python are:

                 Name             Symbol                       Purpose                      Example          Output
                Addition             +                      Add two values                   16+14             30
               Subtraction           -           Subtract second values from the first
                                                                value                        16-14              2
             Multiplication          *                   Multiplies two values               10*20            200
                Division             /                    Divides two values                  9/3               3
                Modulus              %              The modulus operator finds the
                                                remainder after division of one number      100%99              1
                                                              by another.

                70
                70
   191   192   193   194   195   196   197   198   199   200   201