0

Python: for Loops and the range() Function

"""I want to know why we use an 'i' character in the 'for' statement? Thanks in advance!""" print('My name is') for i in range(5): print('Jimmy Five Times (' + str(i) + ')')

15th Jan 2020, 11:31 PM
Anthony B.
Anthony B. - avatar
7 Answers
+ 2
This is essentially what happens in a for loop: i = 0 print(whatever) i = 1 print(whatever) i = 2 print(whatever) ...
15th Jan 2020, 11:43 PM
HonFu
HonFu - avatar
+ 1
i=3; print(i) i=2; print(i) i=1; print(i) i=0; print(i)
18th Jan 2020, 9:47 PM
HonFu
HonFu - avatar
+ 1
HonFu that make sens now thank you so much
19th Jan 2020, 2:35 AM
Makan Macalou
0
Thank you!
15th Jan 2020, 11:42 PM
Anthony B.
Anthony B. - avatar
0
completely confused
16th Jan 2020, 12:38 AM
Abdullahi Zubairu
Abdullahi Zubairu - avatar
0
Hello all I don't understand why the answer is 4, can someone please explain. here is the question: How many numbers does this code print? i = 3 while i>=0: print(i) i = i - 1
18th Jan 2020, 9:35 PM
Makan Macalou