Append the same value multiple times to a list

Viewed 71383

To make my program more beautiful instead of ugly, I am trying to find a more pythonic way of adding a single value multiple times to a list. I now use a loop, but I create a variable I do not use.

l = []; n = 5; v = 0.5

for i in xrange(n):
    l.append(v)

Any ideas?

4 Answers
Related