Skip to main content

Posts

Showing posts with the label from

Dictionary on Python Hunter by Pran Sukh

We have learned about list in previous blogs, list can contain dictionary object vice versa. Both has the ability to change their size at run time. list and dictionary can grow and shrink according to elements at run time. But what is the actual difference b/w these two? Read below.  One is that elements from list object contains elements in linear manner but the dictionary object contains elements as key and value pair.   Elements from list object are fetched with element's location but in dictionary the elements is fetched with key. Last but not the least that list is an ordered object means when the list object is printed it shows the elements as these were inserted but dictionary sort the keys and print the values.      Examples:-  1 2 3 dict_ = dict () dict_ = { "Python" : "Hunter" , "Is" : "Better" } print (dict_) There are lot of methods to manipulate the dictionary object but some of the met...

List, Tuple and manipulation operation on Python Hunter's blog.

   List   in python are the most flexible datatype in python. Python list looks identical to c++ and java's array (elements separated by ',' coma) but unlike in features. Like c++ and java's array hold only similar types of elements (e.g String, int, double) and these programming languages have limitation to grow the size of their declared array at run time, array size has to defined at compile time (there could be some logic to decide the array size at run by getting the user's input but, after that it will be fixed, but it is not recommended) But Python list is slightly different from c++ and Java's array as it can grow it's size at run time and hold any multiple dataType in one single list (e.g string, int, char, Boolean....... all together in one list ).      # Following are the ways to create list. Output:- ---------------------- Source Code Starts -------------------- 1 2 3 4 5 6 7 8 9 10 1...