for i in range(5):
do this action
Is (the Python way of saying
“for each element in range(5)
do this action”.
range(5)
can be replaced by any iterable collection.
In this example the variable i is not used. We might write
for i in range(5):
print(i)
which would print out all the values from the expression range(5)
.
1
solved Explain the meaning of ‘ i ‘ in the following code [closed]