错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Loops: How Do I Repeat Program Instructions Efficiently?

  • Joachim L. Zuckarelli

摘要

In this chapter we deal with the efficient repetition of the same program instructions. In this way, many complex tasks can be solved elegantly. Like most programming languages, Python knows both counting (for) and conditional (while) loops for this purpose. A Python peculiarity are the list comprehension expressions based on the for loops, with which you can write the generation of lists very compactly.