如果我想说一段时间循环(比如:while time is greater than or equal to 0 ),它会被写成while time > or == 0吗?还是没办法这么做?
发布于 2013-12-15 05:53:08
使用while time >= 0 (相当于while time > 0 or time == 0)
>>> 0 >= 0
True
>>> 1 >= 0
True
>>> -1 >= 0
False发布于 2013-12-15 05:52:57
它将是:
while time >= 0:
pass
#here be dragons发布于 2013-12-15 06:00:49
在Python示例中计数:
time = 0
while time < 100:
time = time + 1
print timehttps://stackoverflow.com/questions/20591657
复制相似问题