0

Can somebody explain why this creates a list of 5 elements:

['']*5

While this create a tuple of 1 element

('')*5

But this creates a tuple with six elements:

('', '')*3

Question: is there a way to create tuple with an odd number of elements without using a generator (i.e. by using *)?

Nijan
  • 568
  • 1
  • 5
  • 14

1 Answers1

4

('') is actually not a tuple, it is a string. You want to write ('',).