3 - 5 ( ), , , . . , .
"" (, ), :
def all_true(*args):
for test in args:
if bool(test) is False: return False
return True
foo=bar=foobar=barfoo=foobarfoo=barfoobar=1
if foo:
if bar:
if foobar:
if barfoo:
if foobarfoo:
if barfoobar:
print "True by Stairs!"
if all_true(foo,bar,foobar,barfoo,foobarfoo,barfoobar):
print "True by function!"
t=(foo,bar,foobar,barfoo,foobarfoo,barfoobar)
if all_true(*t): print "The tuple is true!"
l=[foo,bar,foobar,barfoo,foobarfoo,barfoobar]
if all_true(*l): print "list is true!"
bar=0
all_true() .
source
share