0
Conditions and loops (python)
How to set up a condition which only works when the other conditions are false for all instances (elements ) of the iterable .
6 Antworten
+ 2
if all(not [instance condition(s)] for instance in iterable):
# do stuff if all [instance condition(s)] are false
+ 2
if
elif
elif
...
else <--- this one runs when all others don't pass. you could call it the default.
0
Thanks that is what i was looking for.
0
the square brackets no.
however you could use parenthesis (round brackets) to enclose your conditionnal expressions ;)
0
edited my answer to remove the unexpected 'if' ^^
- 1
Are the brackets part of the code?