I'm having the following compile error:
del(alimentos[i]) TypeError: 'str' object doesn't support item deletion
What did I do wrong? I would like to remove the typed element from the list.
My code:
dieta = []
alimentos = ""
comer = ""
while len(dieta) is not 26:
alimentos = input("Qual o alimento? ")
if alimentos == "fim":
break
dieta.append(alimentos)
i = 0
while i <= len(dieta):
comer = input("Qual alimento deseja comer? ")
if comer in dieta:
print("pode comer")
del(alimentos[i])
i += 1