I´m making a vote system, and i´m making a input, where´s the "user" put the name of the candidate and the name is registrered, but when the "user" ( a.k.a me ) press "0" to exit, they show the list of candidates normally, but the letters show separated and with the comma, like "T, h, o, m, a, s" or "P, e, t, e, r".
I´ve tried making it string, and using the "join" function, but it aplicates the ", " for space in every letter.
def urna():
candidatos = []
completo = False
while completo == False:
adicionar = input("Coloque seus candidatos aqui, ( 0 para sair ): ")
if adicionar == "0":
candidatos_formatados = " ".join(candidatos)
print()
print("Fim!")
print()
print("Esse foi(ram) o(s) candidato(s) registrado(s):", candidatos_formatados)
break
else:
print()
candidatos.extend(adicionar)
print("Foi adicionado(a) o(a) candidato(a) %s" % adicionar)
print()
I expect the output like: "Thomas, Peter, Johann, Hawking, Stephen" and so on; But the actual output of this print is: "T, h, o, m, a, s", look at the image below: