Master the Python range () function and learn how it works under the hood. You most commonly use ranges in loops. In this tutorial, you'll learn how to iterate over ranges but also identify when there are better alternatives.
Python Range () function explained The range () function generates a list of numbers. This is very useful when creating new lists or when using for loops: it can be used for both. In practice you rarely define lists yourself, you either get them from a database, the web or generate them using range ().