+ 1

So once a tuple is created with some values can it be extended?

24th Sep 2016, 7:13 PM
Руслан Слободян
Руслан Слободян - avatar
4 odpowiedzi
+ 4
Nope. Tuples are immutable. That means that after creating you can't change them anymore.
24th Sep 2016, 8:04 PM
Amarie
+ 1
The only way to change a value in a tuple is to create a new tuple with the new value(s)
25th Sep 2016, 11:22 AM
Amaras A
Amaras A - avatar
+ 1
You cannot change a tuple because they are immutable but you can append it.
10th Jan 2017, 9:19 PM
Samantha Jordan
Samantha Jordan - avatar
0
tup=(1,2,3) tup+=(4,) print (tup) #(1,2,3,4)
9th Jan 2017, 2:48 AM
ramzi
ramzi - avatar