小编Ach*_*run的帖子

我的作业有些问题。关于停止循环

我正在做作业。而且我找不到如何执行此解决方案。

我已经尝试过在声明中使用中断,但没有任何回报。问题是“完成以下程序,以使循环在找到大于1000且能被33和273整除的最小正整数时停止。”

这是我尝试执行的代码

n = 1001 #This one is required

while True: #This one too
    for i in range(n,___): # I don't know what should i put in the blank
          if i%33 == 0 and i%273 == 0: # I really confused about this line
              break # Should i break it now?, or in the other lines?
print(f"The value of n is {n}") #This one is also required
Run Code Online (Sandbox Code Playgroud)

我不知道我应该在哪些行中打断(或者我不必使用它?),或者我应该创建一个调用列表最小数量的函数?

我为自己的语言以及接受每条评论而对自己的编程技能有多愚蠢感到抱歉。谢谢

python for-loop break while-loop

7
推荐指数
1
解决办法
159
查看次数

标签 统计

break ×1

for-loop ×1

python ×1

while-loop ×1