What is the output of `[*range(3), *range(3)]`?

Python Professional Hard

Python Professional — Hard

What is the output of `[*range(3), *range(3)]`?

Key points

  • The asterisk (*) unpacks the elements of the ranges.
  • The elements of the two ranges are combined into one list.
  • The final output is a list with all the elements in sequence.

Ready to go further?

Related questions