Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created July 23, 2020 00:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/d4bb594203af7908f6dfa0af55abea2f to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/d4bb594203af7908f6dfa0af55abea2f to your computer and use it in GitHub Desktop.
#range()
a=range(1,10,5)
print (type(a))#Output:<class 'range'>
#Converting range(iterable) into iterator object using iter() function.
b=iter(a)
print (b)#Output:<range_iterator object at 0x0303E650>
print (type(b))#Output:<class 'range_iterator'>
#Applying next() over the iterator.
#Returns one element at a time.
print (next(b))#Output:1
print (next(b))#Output:6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment