+ 4

Tuples versus Constant Variable

what is the different between the two

6th May 2017, 11:54 AM
Sello Selby Bopape
Sello Selby Bopape - avatar
2 ответов
+ 4
both are mutable in a sense that they can't be changes once set, so is the any difference or just different wording in two different languages
6th May 2017, 11:55 AM
Sello Selby Bopape
Sello Selby Bopape - avatar
0
A tuple is immutable, but it also is a sequence and can therefore contain more than one element. Moreover, the elements of a tuple do not need to be of the same type: stuff = ('one', 2, 3.0, {'place': 'here', 'time': 'now'}) print(stuff[3]['time'])
6th May 2017, 5:14 PM
Klaus-Dieter Warzecha
Klaus-Dieter Warzecha - avatar