This is the continuation of series of blog post on getting started to data science using python(part 1,part 2 ,part 3) . So today will explore the building blocks of python with special emphasis on list . As most of the problem we will work down the line in data science journey list is the most used .
List : Probably the most fundamental data structure in Python , it is simply a collection .It is similar to array in other programming language with some additional function to it . will explore more of it in the following examples .
Few varied example of list :
List index start from zero , so will explore more on example of accessing value in the list with the use of square brackets [ ]
More on slicing a list :
More on Accessing value :
Checking of value in list :
Modification in list :
List append :
x.append(’99’)#will append ‘99’ at the last index .
You can try out other function of the list like reverse , sort , remove which are popular in use .
Unpacking of list is convenient when you know the value of it :
Ok by this we have covered the most in list next in the series will explore tuples , set and dictionaries: