Live Engine
Select Topic
easyLoops
A developer is confused about what range() actually returns and how much memory a large range uses. What does this code print?
Code
import sys
r = range(0, 1_000_000_000)
print(type(r))
print(len(r))
print(sys.getsizeof(r))
print(sys.getsizeof(list(range(1000))))