Python 中的重复直到或等效循环

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16758807/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 23:35:08  来源:igfitidea点击:

Repeat-until or equivalent loop in Python

pythonloops

提问by Accay Hassan

I am a beginner in Python programming. I am trying to work on this algorithm that finds convex hull using Graham's scan method. However, in the pseudocode, there is a repeat ... untilloop, which I could not figure out a way to write it in Python.

我是 Python 编程的初学者。我正在尝试使用 Graham 的扫描方法来研究这个找到凸包的算法。但是,在伪代码中,有一个repeat ... until循环,我想不出用 Python 编写它的方法。

How do I write a repeat ... untilloop in Python?

如何repeat ... until在 Python 中编写循环?

采纳答案by John La Rooy

REPEAT
    ...
UNTIL cond

Is equivalent to

相当于

while True:
    ...
    if cond:
        break