【问题标题】:print command inside while loop not getting executed (python) [closed]while循环内的打印命令没有被执行(python)[关闭]
【发布时间】:2021-11-03 19:40:51
【问题描述】:
n=1
while n>=40:
    print(n)
    n+=3

目标是打印一系列 1,4,7....40

对于上述结果,执行 python 时没有给出任何输出。 code and output

【问题讨论】:

    标签: python loops while-loop printing series


    【解决方案1】:

    n 不大于或等于 40,因此循环不会运行。我认为您的意思是 <= 而不是 >=

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-09-21
      • 1970-01-01
      • 1970-01-01
      • 2016-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-28
      相关资源
      最近更新 更多