Robotics & Artificial Intelligence
What are the parameters needed to create a for loop?
Python Control Flow
2 Likes
Answer
The parameters needed to create a for loop are passed through the range() function. These are:
- Initial value — It is an optional parameter that defines the starting value of the loop. The default value is 0.
- Stop value — It is a mandatory parameter that indicates the end condition of the loop. The loop will execute up to stop value - 1.
- Update — It is an optional parameter used to increase or decrease the value of the control variable. The default update value is 1.
Answered By
2 Likes