Find minimum non-negative integer, which not satisfies the condition

Viewed 232

I have function f that takes int and return bool. I want to find minimum non-negative integer x, for which f(x) is False. How can I do it in most pythonic way (ideally one line)?


Here is how I do it now:

x = 0
while f(x):
    x += 1
print(x)

I want something like:

x = <perfect one line expression>
print(x)
3 Answers
Related