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) + ')')
7 Antworten
+ 2
This is essentially what happens in a for loop:
i = 0
print(whatever)
i = 1
print(whatever)
i = 2
print(whatever)
...
+ 1
i=3; print(i)
i=2; print(i)
i=1; print(i)
i=0; print(i)
+ 1
HonFu
that make sens now
thank you so much
0
Thank you!
0
completely confused
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