what are all the difference between list and tuple in python?
Answers
Tuples are just like lists, but you can't change their values. The values that you give it first up, are the values that you are stuck with for the rest of the program.
★☆〖Qบęຮτ ı¨ ø nˇ〗☆★
⭐ Python Data Types⭐
•List: A Mutable, ordered sequence of elements separated by commas, which is enclosed within square brackets...
=> Used when we need :
A simple iterable collection of data, which may go for frequent modifications
•Tuple: An immutable, ordered sequence of elements separated by commas, which is enclosed within round brackets...
=> Used when we need:
No change in the data
•Set: A well-defined, unordered collection of distinct objects or items separated by commas, which is enclosed within curly brackets...
=> Used when we need:
The uniqueness of elements, or to avoid duplicacy
No change in the data
•Dictionary: A well-defined, mutable, unordered collection of key-value pairs called as items; A mapping between a set of keys/indices and a set of values...
=> Used when:
Our data are being constantly modified
We need a fast look-up based on a custom key
A logical association between the key-value pair
____________________________________________________
<Judge It Yourself...>
(Plagiarism-Free ☺️)
Hope it helps you! ヅ
✪ Be Brainly ✪