-2
Good night Raul, all good?
It’s actually quite simple to sort it out.
In the part of your script when you perform 'People.append(Person)' you need to insert a function . copy(). I re-did your code in my editor, if there’s any difference, I ask you to disregard.
Note how I included '.copy()' in the line of your script where you included the '.append' function().
pessoas = []
pessoa = {}
while True:
decisão = str(input('Você deseja adicionar uma pessoa? S/N\nSua resposta: ')).upper()
if decisão == 'S':
pessoa['Nome'] = str(input('Qual o nome da pessoa que deseja adicionar? '))
pessoa['Idade'] = int(input('Qual idade da pessoa que deseja adicionar? '))
pessoas.append(pessoa.copy())
else:
break
print(pessoas)
It turns out that if your script has a looping, your program will automatically be generating the question and storing the name and age, while the answer is equal to’S'. But without making a copy of what is being included, you will end up getting the same result, as you had previously.
I have tried to summarise as much as possible, if you continue with this doubt, I am available.
Good luck Raul.
Raul, please post your code.
– Daniel Mendes
Raul Pacheco, The code here in Stackoverflow should be published as text read the following link to know the reason: https://pt.meta.stackoverflow.com/a/5485/137387
– Augusto Vasques