What is the difference between Lists and Tuples? give an example also.
Difference between Lists and Tuples
1016
12-Jun-2018
Updated on 12-Jun-2018
Prakash nidhi Verma
12-Jun-2018Lists:
The list is a datatype available in Python which can be written as a list in using comma ,separated items between square brackets[]. Important thing about a list is that items in a list need not be of the same type. they can be edited.
Many type of built-in list function are occurred-
* cmp(list1, list2)
*len(list)
*max(list)
*min(list)
*list(seq)
Tuples:
Tuples are just like lists.The differences between tuples and lists are, the tuples cannot be changed unlike lists means can't be edited and tuples use parentheses,whereas lists use square brackets ().
Many type of built-in Tuples function are occurred-
*cmp(tup1, tup2)
*len(tup)
*max(tup)
*min(tup)
*list(tup)
we can perform operation in Lists and Tuples both is shown below:
-Update
-Delete
-Indexing
I hope, It will be helpful for you.
Happy Coding :)