想知道如何将下面的for循环更改为while循环。
同时具有相同的输出。
for i in range(0,20, 4):
print(i)发布于 2018-10-13 15:46:20
就这么简单:
i = 0
while i < 20:
print(i)
i += 4发布于 2018-10-13 15:47:00
i = 0
while i < 20:
print(i)
i += 4发布于 2018-10-13 15:48:39
它将是这样的:
i = 1
while i < 20:
print(i)
i += 4您也可以访问此处了解更多信息:https://www.w3schools.com/python/python_while_loops.asp
https://stackoverflow.com/questions/52790697
复制相似问题