What are the kind of loops available in Python?

Question

What kind of loop operations are available in Python?

Answer

There are three types of loops in Python. The for loop iterates over a list. The while loop executes a block of code repeatedly while the provided expression evaluates to True. A list comprehension is a specialized way to construct a new list using a built-in loop over another list.

9 Likes

4 posts were merged into an existing topic: Where is ‘breed’ defined?

Which is the third loop in python?

1 Like

mentioned in the answer? list comprehension, although that could be considered some kind of for loop

3 Likes