Doubt of lists python3 Conway Game of Life

Asked

Viewed 35 times

0

Good afternoon to you all! I’m currently working on a diagram, where each element is a list. For list entry, I made the following command line:

diagrama_entrada=[]

x=True                                
while x:
    l=input()
    if not l.isdigit():
        lixta=l.split(" ")
        diagrama_entrada.append(lixta)
    else:       
    x=False
    for i in range(int(l)):
        num_sequencias=int(l)


num_colunas=len(diagrama_entrada[0][0])                         
num_linhas=len(diagrama_entrada)                #Linhas

print(diagrama_entrada)

for j in range(len(diagrama_entrada)):
    print(" ".join(diagrama_entrada[j]))

The entry is of the type indicated on this link http://www.ic.unicamp.br/~mc102/Labs/roteiro-lab09.html:

But when I try to analyze the lists individually, they appear that way: [['+-----+'], ['|', '', '', '', '', '|'], ['|', '', '@', '', '|'], ['|', '@', '@', '|'], ['|', '', '@', '', '|'], ['|', '', '', '', '', '|'], ['+-----+']]

That is, the program is disappearing with some empty spaces of the diagram, so that, going through with a for list, gives error.

How could I fix this?

1 answer

0

Try to use:

lixta = list(l)

Instead of :

lixta=l.split(" ")

Browser other questions tagged

You are not signed in. Login or sign up in order to post.