Tuples versus Constant Variable | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 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 Antworten
+ 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
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