0
What is the difference between for i in range(l) and for i in l?why we use in with for loop?Can anyone give me a explanation
3 Antworten
0
It is easiest way to excute loop. It is very less syntax.
https://code.sololearn.com/cGpJghPeFyC5/?ref=app
0
No difference.. You'll get an idea, when you use them with lists or strings..
0
It depends on what the variable 'l' is. if l is a string, list, tuple or a dictionary, you can use for i in l. But assuming you want to maybe countdown to zero or up from 0, range is useful. Eg. For i in range(5): print i. You will get 01234. You should get acquainted with them. You'd understand more as you use them.