List and Tuples in Python3

Lists and Tuples store one or more objects or values in a specific order. The objects stored in a list or tuple can be of any type.
Lists and Tuples are similar in most context but there are some differences.

Here are the syntax differences :

Furthermore, in lists you can insert, delete, change values, whatever you want. With tuples you can’t change values, length etc. as soon as you have defined them.
You may wonder now when you need Tuples, when lists can do everything that Tuples can and more.
Tuples can take up less time if you want to iterate over them because a Tuples operation has smaller size than that of a list, which makes it a bit faster but not that much to mention about until you have a huge number of elements.

Kommentar hinterlassen

Erstelle eine Website wie diese mit WordPress.com
Jetzt starten