+ 1

in python as we have list why we use t-uples?

22nd Jul 2018, 4:27 PM
Abdoulaye
Abdoulaye - avatar
4 Answers
+ 8
Why use tuples? Because they require less processing power from Python because they're immutable. Doesn't make a big diff in small programmes but if you're working on a big project it will improve speed and efficiency. Another thing: they are immutable (unlike lists), so they can be used as dictionary keys. Moreover, tuples can be packed and unpacked. Like this: tup = 'one' , 'two' , 'three' _1, _2, _3 = tup
22nd Jul 2018, 5:17 PM
DAB
DAB - avatar
+ 3
Because tuple cannot be modified but list can be modified.Tuple is faster than list both are different.
23rd Jul 2018, 1:22 PM
Maninder $ingh
Maninder $ingh - avatar
0
Tuple is value data type, so it is faster. You can also make some good tricks with that: (a, b) = (b, a) you can switch values that easy.
22nd Jul 2018, 4:35 PM
Martin Bulíƙ
0
ok thank you so much
23rd Jul 2018, 6:47 PM
Abdoulaye
Abdoulaye - avatar