小编Jon*_*Jon的帖子

python while循环范围函数

为什么不能在 python 中的范围函数上使用 while 循环?

编码:

def main():
  x=1;

  while x in range(1,11):
     print (str(x)+" cm");


if __name__=="__main__":
    main();
Run Code Online (Sandbox Code Playgroud)

作为无限循环执行,重复打印 1 cm

range while-loop python-3.x

5
推荐指数
2
解决办法
4万
查看次数

标签 统计

python-3.x ×1

range ×1

while-loop ×1