for this list ,
l=[i for i in range(1,100)]
How can i restrict to print only 1st 20 elements.
What i am trying to do is ,
>>> counter=0
>>> for index , i in enumerate(l):
... if counter==20:
... break
... print index , i
... counter+=1
...
Is there is another way to do this without using counter variable ?