How do I create a list with 256 elements?
<p>I've started teaching myself Python, and as an exercise I've set myself the task of generating lookup tables I need for another project. </p>

<p>I need to generate a list of 256 elements in which each element is the value of <code>math.sin(2*i*pi/256)</code>. The problem is, I don't know how to generate a list initialized to "dummy" values that I can then use a for loop to step through and assign the values of the <code>sin</code> function.</p>

<p>Using list() seems to create an "empty" list, but with no elements so I get a "list assignment index out of range" error in the loop. Is there a way to this other than explicitly creating a list declaration containing 256 elements all with "0" as a value?</p>
