This is my code atm:
puzzle = [
['1','1','1','1','1','1','1','1','1','1'],
['1','0','0','0','0','1','1','1','1','1'],
['1','1','0','1','0','0','0','0','0','0'],
['0','1','0','0','0','0','0','0','0','0'],
['0','0','1','0','1','0','1','0','0','0'],
['0','0','0','0','1','0','0','0','0','0'],
['1','0','0','0','1','0','1','0','1','0'],
['0','0','0','0','1','0','0','0','0','1'],
]
#30 1 s
counter1 = 0
counter2 = 0
for a in puzzle:
b = ''.join(a)
for search in b:
if search == '1':
counter1 = counter1 + 1
if counter1 > counter2:
counter2 = counter1
#output should be 3
print(counter1, counter2)
Now I am trying to loop vertically through my list. So I can find the highest amount of 1's after each other without a 0 interfering. Starting with counting from the top left. Only I haven't the slightest idea on how to do that. #output should be 3 Could someone help me out?