Given the following example:
container = [ (1, "a") ,
(40, "b") ,
(24, "c") , #we intend to change this
(103, "d")
]
for k,v in container:
if k == 24:
v += " good"
print container
The (24, "c") data pair in container will still remain its original value, and won't be changed to (24, "c good"). What would be the way to alter it to (24, "c good") as intended during the iteration?
I use python 2.7 , but 3.x examples are also welcome.
Thanks.