+ 2

in for loop how we use that some letter' in' operator to range()

for I in range(5): print("hello ")

16th Aug 2016, 6:18 AM
Yagati Pavani
Yagati Pavani - avatar
1 Answer
+ 2
The letter is just a variable. Each time the loop runs, the variable gets a number from the range assigned to it. First time it's assigned a 0, next time a 1 and so on. Every time the loop runs it also does the specified action. In this case it prints "hello" and it'll do it 5 times cause of the range. The range determines how many times it will loop. I hope this explains something.
16th Aug 2016, 10:44 PM
Doc
Doc - avatar