+ 10

What is the difference between lists and tuples in python ?

I need a complete comparison between lists and tuples in python according to usage and performance.

19th Aug 2018, 11:49 AM
Ehab Samir
Ehab Samir - avatar
4 Antworten
+ 12
 A list is mutable, whereas a tuple is immutable. This means that a list can be changed, but a tuple cannot.
19th Aug 2018, 11:55 AM
AuCeallaigh
AuCeallaigh - avatar
+ 6
Key points to remember: The literal syntax of tuples is shown by parentheses () whereas the literal syntax of lists is shown by square brackets [] .Lists has variable length, tuple has fixed length.List has mutable nature, tuple has immutable nature.List has more functionality than the tuple. https://www.programiz.com/JUMP_LINK__&&__python__&&__JUMP_LINK-programming/list-vs-tuples
20th Sep 2018, 10:52 PM
Ehab Samir
Ehab Samir - avatar
22nd Sep 2018, 4:38 PM
Ehab Samir
Ehab Samir - avatar