What would happen if the list was inside normal brackets instead of the square ones? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What would happen if the list was inside normal brackets instead of the square ones?

Brackets

6th Apr 2018, 10:19 PM
Andrew Watts
Andrew Watts - avatar
3 Answers
+ 3
List - ["bar"] Tuple - ("bar") A tuple is similar to a list, but is immutable. This means that a tuple cannot be modified as a list can - it will remain the same as it was when first created. However, a tuple uses less memory. - Use lists when data will be modified. - Use tuples when no data needs to be modified.
6th Apr 2018, 10:23 PM
Nick
Nick - avatar
+ 3
I tried coding such but I received an error
7th Apr 2018, 4:18 AM
Andrew Watts
Andrew Watts - avatar
+ 1
>>> a = (1, 2, 3, 4, 5, 6) >>> type(a) <class 'tuple'> It's not a list actually.
6th Apr 2018, 10:24 PM
Bartosz Pieszko
Bartosz Pieszko - avatar