while循环(Python)

use*_*945 1 python while-loop

如果我想说一些while循环,例如:while time is greater than or equal to 0,它会简单地写成while time > or == 0?或者没有办法做到这一点?

fal*_*tru 6

使用while time >= 0(相当于while time > 0 or time == 0)

>>> 0 >= 0
True
>>> 1 >= 0
True
>>> -1 >= 0
False
Run Code Online (Sandbox Code Playgroud)