What is the result of `(1,) * 3 == (1, 1, 1)`?

Python Professional Hard

Python Professional — Hard

What is the result of `(1,) * 3 == (1, 1, 1)`?

Key points

  • The expression `(1,) * 3` repeats the tuple `(1,)` three times.
  • The comparison checks if this tuple is equal to `(1, 1, 1)`.
  • This demonstrates how tuples can be multiplied to repeat elements.

Ready to go further?

Related questions