Difference Between Similar Terms and Objects

Difference Between Tuple and List

Tuple vs List

Tuples and lists are two different but similar sequence types of the Python language.

Python
Python is a software language which helps one in working more quickly and increases the productivity of the program. It also helps in lowering the cost of maintenance. It is a programming language which helps in integrating the systems effectively, efficiently, and cost effectively.

Python is a language which can be used for free for domestic or commercial products. The reason is that it is OSI (Open Source License) approved. It runs on Mac OS X, Windows, Linux/Unix. Python has been ported to .NET virtual machines and Java.
Tuples and lists of Python are similar sequence types thus causing confusion among people learning the language, but they have some very distinct differences.

Tuples

The literal syntax of tuples is shown by parentheses.
Tuples are immutable. By “immutable,” it is meant that once they are created, they do not support any additional operations which might be added to the language and cannot be modified after they are created.
Tuples are heterogeneous. “Heterogeneous” means that generally tuples are a sequence type which have varied and different types, or the entries made have separate meanings.
A tuple is considered a coherent unit.
Tuples shows structure.

Lists

The literal syntax of lists is shown by square brackets.
Lists are mutable. By “mutable” it is meant that these objects are capable of supporting additional operations. So the list sequence is a type of sequence which supports operations when it is added to the language even after the creation.
They are homogeneous. By “homogeneous,” it means that these sequence types deal with the similar or same kinds of things. One has to deal individually with the items.
Lists show order.

Summary:

1.Tuples and lists are two similar sequences of the same programming language, Python. Tuples are immutable which means they cannot be modified once they are created; whereas, a list is a sequence which is mutable. It can be modified after it is created, and it supports additional operations too.
2.The literal syntax of tuples is shown by parentheses whereas the literal syntax of lists is shown by square brackets.
3.Tuples are heterogeneous while lists are homogeneous. One has to deal individually with the items.
4.Tuples show structure whereas lists show order.


Search DifferenceBetween.net :

Custom Search


Help us improve. Rate this post! 1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 3.00 out of 5)
Loading...

Email This Post Email This Post : If you like this article or our site. Please spread the word. Share it with your friends/family.



1 Comment

  1. Doesn’t mention the very important fact that since tuples are immutable they can be hashed and used as keys in Python dictionaries and sets.

Leave a Response

Please note: comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

Articles on DifferenceBetween.net are general information, and are not intended to substitute for professional advice. The information is "AS IS", "WITH ALL FAULTS". User assumes all risk of use, damage, or injury. You agree that we have no liability for any damages.


See more about :
Protected by Copyscape Plagiarism Finder