Nov-12-2017, 09:50 AM
I want to add an
if
statement in to a for
loop so that if the statement is false, then the loop stops. something like this: for i in range(0, len(list_of_nums) if list_of_nums[-1] != list_of_nums[i]:
is it possible?
i know u can use this structure to build lists, like:
x = [y for y in list_ if statement]
but i couldnt put it as i wanted...