+ 8
What is the difference between list and tuples?
Very critical
12 ответов
+ 9
Main difference
lists are mutable and tuples are immutable.
A mutable data type means that
a python object of this type can be modified. An immutable object can’t.
+ 5
The main difference is that list is mutable and tuple is immutable, meaning that you can change list however you like and the tuple not so much.
+ 5
1. Lists are enclosed with block brackets [ ], while tuples use normal brackets ( )
2. [1] is a valid list while (1) is not a tuple but an int. To make a tuple of 1 item you add a comma like (1,) now that's a tuple.
3. Lists are mutable while tuples are immutable
4. .....
+ 2
Check this link.
https://www.afternerd.com/blog/difference-between-list-tuple/
+ 1
Moreover, tuple uses less data than list and we can acess tuple faster than list( that’s what i’ve learned)
0
Tuples and list are similar.
But they have some differences.
List can be edited like we can append, pop, insert value inside list, that's mean they are mutable.
And also list start with large braces [].
Beside this, tuples are the list that can not be edited once created, that's mean they are immutable.
And also tuples start with medium braces {}.
0
سلام
0
18
0
List is mutable and tuple is immutable. Which means in list you can add string/number/float in it at any time but In tuple you can't add new items once it's made.
List's syntax is [ ] and tuple syntax is ( )
0
list - you can play around with it.
Tuple - once u define it don't dare to mess with it .