+ 2
What are tuples??
2 Answers
+ 4
Basically a list but you can't edit it after creation. You work with them in the same way as you would with lists. Also they are much faster.
>>>mytuple = ("value1", 2, False)
>>>print(mytuple[0])
value1
+ 2
tuples are immutable lists. so if you don't want to edit a list after creation, use a tuple instead because tuples are faster.
one use of it can be as keys for dictionaries, because dictionary keys should be immutable.
in functional programming, tuples are preferred over lists because in purely functional programming, all variables are immutable.