+ 1
for i in range(21) ?
can someone explain to me what does for i in range mean ? please.
3 Answers
+ 4
"i" is assumed as the local variable in the statement.
It has no value outside the range.
It is a temporary variable for creating range.
you can use any variable in place of "i". "i" is commonly used to represent iterator
For more explanation, see these threads:-
https://www.sololearn.com/discuss/236319/?ref=app
https://www.sololearn.com/discuss/1922018/?ref=app
+ 4
i is just a variable used in the loop.
You can change and make it c, p, j , etc........
Just to define the value
+ 2
hi mitch
ârange(21)â - a function producing numbers ranged 0 through 20 (essentially 21 numbers.. starting with 0)
âfor i inâ - for loop which iterates over the function ârange(21)â think of âiâ as a variable, it represents the instance of each number produced by range
so there will be 21 iterations starting with the number 0 in this loop