lista = ['Ana', 'Carlos', 'Pedro']
nome_errado = input("Digite o nome incorreto: ")
nome_correto = input("Digite o nome correto: ")
indice: int = lista.index(nome_errado)
lista.remove(nome_errado)
lista.insert(indice, nome_correto)
print(f"O nome {nome_errado} foi substituído por {nome_correto}.")
print("Lista atualizada: ",lista)