Part 5: Working on Tuples , Set and Dictionaries

Part 5: Working on Tuples , Set and Dictionaries

This is the continuation of series of blog post on getting started to data science using python(part 1,part 2,part 3,part 4) . So today will explore the building blocks of python with special emphasis ontuple , set and dictionary .

Tuple is pretty much similar to list without the mutable function that is it cannot be modified .

You can specify tuple with parentheses or nothing but with out the square bracket .

Dictionaries :

Another very important data structure in python which associates values with keys and you can extract the value corresponding to a given key .

Againyou can make use simple tab to know the function available in the dictionary with .tab after the name of the dictionary.

Lets look at some of the function :

Get is used to retrieve value

** Important note :

Dictionary keys must be immutable; in particular, you cannot use lists as keys. If you need a multipart key, you should use a tuple or figure out a way to turn the key into a string.

Set :

Set is another data structure in not so frequent in use as list and dictionary which is a collection of distinct elements .

** Important note :

The in operator in set is very fast in executing operation .

Find distinct item from a collection .

Ok by this we have covered the most in set , tuple and dictionaries next in the series will explore conditional statement and function .

Happy learning and sharing !!

Instructor lead Online training in Datascience join our watsapp group

Upgrade your skills join our community

Leave a Reply

Close Menu