Range Object vs Generator Object
def gen():
for i in range(3):
yield i
r = range(3)
g = gen()
print(list(r), list(r))
print(list(g), list(g))
What gets printed?
Sign in to answer questions and track your progress
Sign Indef gen():
for i in range(3):
yield i
r = range(3)
g = gen()
print(list(r), list(r))
print(list(g), list(g))
What gets printed?
Sign in to answer questions and track your progress
Sign In