Answer the question
In order to leave comments, you need to log in
Is it possible to iterate over functions in a loop?
def blablabla():
if abc1() >2:
return True
if zxc2() >2:
return True
... и тд.
def abc1():
print('один')
return 1
def zxc2():
print('два')
return 2
def ffn3():
print('три')
return 3
superlist = [
abc1(),
zxc2(),
ffn3(),
]
for i in superlist:
if i > 2:
print(i, 'нашли')
break
print(i, 'перебираем')
else:
print('Ничего не найдено')
Answer the question
In order to leave comments, you need to log in
superlist = [
abc1,
zxc2,
ffn3,
]
for function in superlist:
if function() > 2:
и так далее
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question