Raspberry for-loop
A for-loop is generally used to traverse all elements in a sequence, such as:
for i in range(10) :
print(i)
The output of the program is as follows:
0
1
2
3
4
5
6
7
8
9
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.