- 1
I just did the for loops module and I don't understand any of it. can I have an explanation of the whole module?
4 Answers
0
that maybe a lot of work, why don't you try reading from somewhere else or use youtube
0
that maybe a lot of work, why don't you try reading from somewhere else or use youtube
0
ok
0
The for loop will run through all the code inside it one time for every item in an iterable. One more thing it does is allows you to assign a variable to whatever item is currently being run.
An example would be as follows. . .
my_list = [1, 2, 3, 4, 5]
for x in my_list:
print (x)
This would output the following:
1
2
3
4
5
In that example, x could be any variable name. It is common practice to use a variable name that represents the information it holds, like num, or my_list.
Hope that helps!