A for-loop is generally used to traverse all elements in a sequence, such as:
The output of the program is as follows:
Where, range() is a built-in function of MicroPython, which can generate a list of integers. Generally, we use this function in for-loop. For example, range (10) creates a list of nine integers from 0 to 9.
In this program, we will use the for-loop to traverse and use print() to output all the integers to the Shell.