+ 1

Can we change value of list of tuple?

Example list = [1,2,(3),4,5] I want to change value of 3 is it possible?

17th Mar 2019, 3:25 PM
Masud Shaikh
Masud Shaikh - avatar
3 Réponses
+ 6
Hi you can just overwrite it with new tuple so you need to edit list[2] =(4) but you can not edit tuple inside as it is immutable.
17th Mar 2019, 3:36 PM
Hubert Dudek
Hubert Dudek - avatar
+ 4
list[2] is no tuple, btw. You have to write (3,).
17th Mar 2019, 3:50 PM
HonFu
HonFu - avatar
+ 1
okay, Thanks
17th Mar 2019, 3:39 PM
Masud Shaikh
Masud Shaikh - avatar