Is there a dynamic way (without resorting to a loop or using the fixed []
) of creating a Python list with N
elements?
The elements can be anything e.g. strings, numbers, characters, etc. For example if N = 6
, how can I dynamically create a list that has 6 string elements "abc"
?
["abc", "abc", "abc", "abc", "abc","abc"]
This should be dynamic for different values of N
and the list elements.