@Mr. Affinity Types of loops in python
- User
@Mr. Affinity Types of loops in python
- Assistant
In Python, there are several types of loops that you can use to iterate over data. The two most common types of loops are:
1.
forloopThe
forloop is used to iterate over a sequence (like a list, tuple, string, or range). It allows you to execute a block of code for each item in the sequence.Example:
python