Posts

Showing posts with the label Lists - Data Structures

Python3 Lists DS

Python : Data Structures Data Structure Lists   Data structure:        A data structure is a collection of elements(such as numbers or character-or even other data structures) that is structured in some way, for example, by numbering the elements. The most basic data structure in Python is the "sequence". ->List is one of the sequence data structure ->Lists are collection of items(strings, integers or even other lists) ->Lists are enclosed within [ ] ->Each item in the list has an assigned index value. ->Each item in a list is separated by a comma( , ) ->Lists are mutable, which means they can be changed. List creation : Eg:        emptyList=[ ]        lst=['one', 'two', 'three']            #list of strings        lst2=[1,3,2,4]                            #list of integers        lst3=[[1,2],[3,4],5,6]]              #list of lists        lst4=[1,'krishna',4,6.5]             #list of different datatypes        print(lst4) outp