Is there any reason to use tuple instead of list? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Is there any reason to use tuple instead of list?

I don't see how tuples can be practical...

17th Apr 2018, 12:53 PM
DAG
3 Answers
+ 8
Check out the answer starting as follows: "Tuples are fixed size in nature whereas lists are dynamic. In other words, a tuple is immutable whereas a list is mutable." Here: https://stackoverflow.com/questions/1708510/JUMP_LINK__&&__python__&&__JUMP_LINK-list-vs-tuple-when-to-use-each
17th Apr 2018, 1:01 PM
Emma
+ 1
yes because the strings in tuple is unchangable and in list we can change i think
26th Apr 2018, 7:54 AM
Jamaluddin Huseinkhail
Jamaluddin Huseinkhail - avatar
+ 1
in some cases you might want to not change your orijinal data just want to use it. so using tuples guaranties that your data stay original.
29th Jun 2018, 6:00 PM
Servet Birlik
Servet Birlik - avatar