My goal
My goal was to remove all elements from "inventario" that had a certain serial
The problem
The code cannot remove multiple elements from "inventario" even if they have the same serial
I do not have any "errors" in the output
I am using Python 3.6
My goal was to remove all elements from "inventario" that had a certain serial
The problem
The code cannot remove multiple elements from "inventario" even if they have the same serial
inventario = [] resposta = "S" while resposta == "S": equipamento = [input("Nome:"), float(input("Valor:")), int(input("Número de Serie:")), input("Departamento:")] inventario.append(equipamento) resposta = input("Digite \"S\" para continuar: ").upper() for elemento in inventario: print("\nNome.........:", elemento[0]) print("Valor........:", elemento[1]) print("Serial.......:", elemento[2]) print("Departamento.:", elemento[3]) serial = int(input("Digite o serial do equipamento que será excluido:")) for elemento in inventario: if elemento[2] == serial: inventario.remove(elemento) for elemento in inventario: print("\nNome.........:", elemento[0]) print("Valor........:", elemento[1]) print("Serial.......:", elemento[2]) print("Departamento.:", elemento[3])Observations
I do not have any "errors" in the output
I am using Python 3.6