0
lista_da_tupla_a=(["0", "33", "40"], ["8", "30","9"], ["7", "0", "0"])
lista_da_tupla_a = list
lista_da_tupla_a[2] = "5"
print(lista_da_tupla_a)
Desired exit: (["0", "33","5"], ["8","30",5], ["7","0","5"])
0
lista_da_tupla_a=(["0", "33", "40"], ["8", "30","9"], ["7", "0", "0"])
lista_da_tupla_a = list
lista_da_tupla_a[2] = "5"
print(lista_da_tupla_a)
Desired exit: (["0", "33","5"], ["8","30",5], ["7","0","5"])
0
I think what you want is this:
lista_da_tupla_a = (["0", "33", "40"], ["8", "30","9"], ["7", "0", "0"])
for tuplinha in lista_da_tupla_a:
tuplinha[2] = "5"
print(lista_da_tupla_a)
I mean, you use the for
to go through each trio and replace the third element with "5"
.
Here’s the way out:
(['0', '33', '5'], ['8', '30', '5'], ['7', '0', '5'])
Browser other questions tagged python python-3.x
You are not signed in. Login or sign up in order to post.