2
I made a random number generator that generates and saves in.txt file
I made generate 3 combinations, it happens that when I open the txt the combinations are on the side of the other, as I do to be below each other?
import random
c1 = (random.choice([9, 9]))
c2 = (random.choice([1, 1]))
c3 = (random.choice([9, 9, 9]))
lista = []
def gerar_randomico():
return random.choice([2, 3, 4, 5, 6, 7, 8, 9])
def gerar_randomicus():
return random.choice([6, 7, 8, 9])
for i in range(3):
lista1 = ('{}{}{}{}{}{}{}{}{}{}{}'.format(c1, c2, c3, gerar_randomicus(), gerar_randomico(), gerar_randomico(),
gerar_randomico(), gerar_randomico(), gerar_randomico(),
gerar_randomico(), gerar_randomico()))
with open('arquivo.txt','a') as arquivo:
arquivo.write(str(lista1))
lista_guardar = lista.append(arquivo)
print(lista_guardar)