Page 193 - AI Ver 1.0 Class 10
P. 193

Sets
                 Set is a mutable, unordered collection of values, of any type, with no duplicate element. For example:









                 Maps
                 Maps are unordered data type used for mapping keys with its corresponding value.

                 Dictionary
                 Dictionary is an unordered, changeable sequence of elements stored in a combination of Key:value in curly
                 braces. Each key-value pair is separated by a colon(:), and each key is separated by a ‘comma’. For example:










                 Operators
                 Operators are used to perform operations on variables and values. Let us study in detail about the commonly
                 used operators in Python.


                 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

                  Exponential            **      First number raised to the      2**5                  32
                                                 power of the second number.     3.5**3                42.875

                  Multiplication         *       Multiplies two values           5*4                   20

                                                 Note: String * int repeats string   3.5*2             7.0
                                                 that many times.                "Bye"*2               ByeBye

                  Division               /       Divides two values.             9/3                   3.0
                                                                                 6.0/3                 2.0
                                                                                 6/3.0                 2.0

                                                                                 17/2                  8.5
                  Floor division         //      Divides the first number with   17//3                 5
                                                 the second and returns the      -18//5                -4
                                                 whole number adjusted left to
                                                 the number line.                23//6                 3







                                                                                           Advance Python   191
   188   189   190   191   192   193   194   195   196   197   198