Introduction to Range and Enumerate in For Loops

Greetings, Explorer! In today's adventure, we're traversing the vast expanse of range() and enumerate(). These two functions will serve as your co-pilots, guiding your spaceship, the for loop, through the expansive universe of Python. We're set to delve into each function, uncovering hands-on examples and real-life applications.

Exploring the Range Function

Our first destination is the planet range(). This Python function generates a sequence of numbers, which are pivotal when directing a loop a specified number of times.

The range() function can accept three different sets of parameters:

  • range(stop): generates numbers from 0 to stop - 1.
  • range(start, stop): generates numbers from start to stop - 1.
  • range(start, stop, step): generates numbers from start to in steps of .
Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal