-1

I'm wondering how to have a list with all the same items, but the length be equal to and equation, for example:

myList = 'a' * 10

but this gives you

myList = 'aaaaaaaaaa'

when I want

myList = a, a, a, a, etc.
styvane
  • 59,869
  • 19
  • 150
  • 156
Maximus
  • 71
  • 9
  • 3
    Your syntax is slighty off: use `['a'] * 10` instead. See: http://stackoverflow.com/questions/3459098/create-list-of-single-item-repeated-n-times-in-python – user268396 May 14 '16 at 21:21

1 Answers1

3

This looks like the shortest way:

['a']*10
schafle
  • 615
  • 4
  • 10