My issue
why i = 20 is specified there? my code ran even if it was not there
My code
#i = 20
for i in range(20,45, 2 ):
print( i )
Learning course: Learn Python
Problem Link: CodeChef: Practical coding for everyone
why i = 20 is specified there? my code ran even if it was not there
#i = 20
for i in range(20,45, 2 ):
print( i )
Learning course: Learn Python
Problem Link: CodeChef: Practical coding for everyone
Yes, it works because even you do not initialize i=20, for loop will start from 20 only as it has starting parameter = 20.
for loop parameters : (start, end, increment/decrement)
Hence, it does not matter whether you initialize i in this code or not.
Hope it helps.