首页 > 解决方案 > 在 y 增加后做 x

问题描述

我想在iis 20,40等之后做一些事情。

例如:

i = 0
while True:
    i+=1
    if i == # increment of 20 (40, 60, 80, etc.):
        # do this

标签: python

解决方案


i = 0
while True:
    i+=1
    if i % 20 == 0: # increment of 20 (40, 60, 80, etc.):
        print(i) #or something else

输出:

20
40
60
80
...

推荐阅读