Write a C-Style Loop With range() and Multiple Parameters
So far in this course, you’ve seen how to avoid writing C-style loops in Python. But what if you need to write a C-style loop, and it needs to be in Python?
If you take a closer look at the
range() built-in, you’ll see that you can call it with multiple parameters:
step. So you can use
range() in a way that closely maps to a C-style loop.
Become a Member to join the conversation.