The list comprehension shouldn’t be in the loop, it should be instead of the loop.
all_new = [behave[i] for i in range(11) if test[i] == 1]
print(all_new)
0
solved How can I put all value in list into same line [closed]
The list comprehension shouldn’t be in the loop, it should be instead of the loop.
all_new = [behave[i] for i in range(11) if test[i] == 1]
print(all_new)
0
solved How can I put all value in list into same line [closed]