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.