Tuples in Python are read only lists which means after a tuple is created it does not allow any of its elements to be modified. In this post we are going to see that tuple elements can be modified. Following are the examples. From the above example it is evident that we are able to update […]
Author: Krishna B
Python – What type of elements can Set have ???
Sets are mutable (can be changed) data types where you can add elements to it. But the elements you want to add must be immutable. Yes, you hear it right. Sets are mutable data type which can allow only immutable elements added to it. In all the above examples you can see it is not allowing […]
Python – Adding elements to List without using append or extend method
Can we add elements to a list object without using append or extend methods of list. Lets check with an example. We can see it is not possible because memory allocation for list object in python happens at run time. So when the list L is created with three elements and try to access 4th […]
Python – What Extend method can do ???
You might have used extend method in Lists where it can be used to add multiple elements to a list object. But what else it can be do is the topic of our discussion here.To add multiple elements to a list using extend method is technically not a right way of understanding the method functionality. […]
Deep Dive into Tuples — Python
Tuples are read-only lists whereafter it is created with some elements you cannot add any elements into it. Hence it is called Read Only Lists. Following is an example showing a tuple and how it behaves when you add an element after it is created. Github link: https://github.com/bvvkrishna/Tuples/blob/master/Tuple%20Basic%20Example.ipynb Can Tuples be modified? Tuples can also be […]
Sets the Maths one — Python
Sets are mutable data type objects containing a collection of elements. It is an unordered collection and contains only unique objects in it. Being an unordered data structure it will not record element position or the order elements are inserted into it. The other name for sets are Value-less dictionaries and they are internally implemented […]
Dictionary Walk Through— Python
Dictionary is a mapping data structure containing a set of elements where each element is a key-value pair. Dictionaries in other programming languages are called as Hashes or Associative arrays. Dictionaries are indexed by keys rather than integer numbers like in lists or tuples. An example of a simple dictionary is as follows. Alternative Ways […]