What are the built-in types of python?
Python has several built-in data types, including:
range
and xrange
are used for creating sequences of numbers.range
returns a list containing all the numbers in the specified range. It generates the entire list in memory.xrange
, on the other hand, returns an xrange object, which is an iterable. It generates numbers on-the-fly as needed, making it more memory-efficient for large ranges.range
itself behaves like xrange
from Python 2, so there's no xrange
in Python 3.