预计阅读本页时间:-
Chapter Summary
In this chapter, we explored Python’s looping statements as well as some concepts related to looping in Python. We looked at the while and for loop statements in depth, and we learned about their associated else clauses. We also studied the break and continue statements, which have meaning only inside loops, and met several built-in tools commonly used in for loops, including range, zip, map, and enumerate (although their roles as iterators in Python 3.0 won’t be fully uncovered until the next chapter).
In the next chapter, we continue the iteration story by discussing list comprehensions and the iteration protocol in Python—concepts strongly related to for loops. There, we’ll also explain some of the subtleties of iterable tools we met here, such as range and zip. As always, though, before moving on let’s exercise what you’ve picked up here with a quiz.