Good afternoon, how are you?
Dude, it depends on the way you're doing things, I'm without python on this computer, but I believe this code will do what you're thinking, I hope it returns if it did, or not, right. I'll be waiting.
lis_ord = []
while True:
num = int(input("Por favor, adicione um número a lista [insira 0 para sair]: "))
if num > 0 or num < 0:
lis_ord.append(num)
lis_ord.sort
print("O número foi adicionado com sucesso, sua lista é:")
print(lis.ord)
elif num == 0:
print("Obrigado por usar o programa. Encerrando.")
break
else:
print("Comando inválido. Use apenas números.")
The above code block should work as follows:
Create a list and link it to the variable lis_ord;
While true, it asks the user to provide an input, stored in the variable num, then it organizes the list from the smallest to the largest, the printa that the number was added, and displays the list in its current state;
If the input is greater or less than zero, it appends the lis_ord list;
If the input is zero, it terminates the program;
If the input is a STRING, or a FLOAT, for example, the invalid command line, and returns to the input of the user;
Maybe something is wrong, because I did not have the test, but, whatever, return with an answer and I'll try to help again.
Placing your code would also be of great help in understanding where the error is occurring.
Hope to have helped, hugs.