Posts by Victor Faraon • 41 points
1 post
-
3
votes1
answer79
viewsQ: Why does changing items from a list with multiple assignment not work when I use "index()" inline in assignment?
I can swap a and b with this code: lista = ['a', 'b', 'c'] item = 'a' # itens que quero localizar e trocar outro_item = 'b' # indice_item = lista.index(item) # obtenho a posição de ambos…