Looping: Definite Iteration
The most common use for the
range function is looping. In computer science, a loop is a structure that allows you to run a block of code multiple times without having to write that code over and over again. One type of loop that Python supports is the
for name in names: check_name(name)
This loop will execute for each name in the list.
name is simply a temporary variable that will change on each loop.
Comments & Discussion
Become a Member to join the conversation.