Sep-19-2020, 03:33 AM
In your example range(9) is a range object. A range object is an iterator that produces a sequence of integers. Wrapping [] around the range object makes it a list that contains a range object.
list(arg) is a function that creates a list. arg is an iterator that is used to generate elements for the list. Passing range(9) to list() uses range(9) as an iterator to generate integers zero through eight.
list(arg) is a function that creates a list. arg is an iterator that is used to generate elements for the list. Passing range(9) to list() uses range(9) as an iterator to generate integers zero through eight.