Answer the question
In order to leave comments, you need to log in
Why doesn't the function continue the loop?
Why doesn't this code work?
list = [1, 2, 3, 4, 5, 6, 7, 8]
for i in list:
def not_eight():
if i != 8:
return continue
else:
return break
btn = Button(window, text="Продолжить", command=next)
Answer the question
In order to leave comments, you need to log in
return should return value
def not_eight(i):
if i == 8:
return True
list = [1, 2, 3, 4, 5, 6, 7, 8]
for i in list:
if not_eight(i):
break
Well, you defined the function 8 times, the code honestly did everything. Except for a small nuance (XD) in this approach, the code is working. What do you want the code to do?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question