Computer Science, asked by asif04, 1 year ago

what are all the difference between list and tuple in python?

Answers

Answered by hasnatmirza111p06f0z
3
Lists are what they seem - a list of values. Each one of them is numbered, starting from zero - the first one is numbered zero, the second 1, the third 2, etc. You can remove values from the list, and add new values to the end. Example: Your many cats' names.

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. 
Answered by MrEccentric
2

★☆〖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 ✪

Similar questions