Posts

Showing posts with the label data types 2

Python3 Data types 2

Python Data types 2. PYTHON LIST : List is an ordered sequence of items. It is most used datatype in Python and more Flexible.     *  Declaring a list is, items Separated by commas( , ) are enclosed within brackets [ ].   eg:       a=[10,'hello',10.3]              print(a[1])                 #print index element                        output: 'hello'  *  Lists are mutable ,meaning ,elements in a list can be altered.     eg:     a=[21,30.3,'list']             print(a)             a[1]=3.3             print(a)            output:     [21,30.3,'list']                       [21,3.3,'list'] For more information suggested video  https://youtu.be/e1ruxK_6XZY PYTHON TUPLE :      Tuple is an ordered sequence of items same as list. The only difference is that tuples are immutable, Tuples once created cannot be modified. Declaring a tuple ,elements are separated by commas( , ) and enclosed within parentheses  ( ).    eg:       b=(10,2.5,'tuple')