Indexing variables and adding month to variable name in python3.5
<p>I'm trying to set up a list of variables to work with in a linear programming problem. For this I'd like to work with some index values to make the code significantly shorter and easier to read. I'd tried something as:</p>

<pre><code>from datetime import *

months = ["Unknown", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]

d={}

for x in range(1,13):
    d["string{0}".format(x)]=("Production in months[d]")

print(d)
</code></pre>

<p>This returns me a list:</p>

<pre><code>{'string7': 'Production in months[d]', 'string8': 'Production in months[d]', 'string2': 'Production in months[d]', 'string9': 'Production in months[d]', 'string11': 'Production in months[d]', 'string6': 'Production in months[d]', 'string12': 'Production in months[d]', 'string3': 'Production in months[d]', 'string10': 'Production in months[d]', 'string4': 'Production in months[d]', 'string1': 'Production in months[d]', 'string5': 'Production in months[d]'}
</code></pre>

<p>I would like to have the name of the month where months[d] is printed, corresponding to the index number i in 'string[i]'.</p>

<p>Use: </p>

<pre><code>d["string{0}".format(x)]=("Production in %s" % months[d])
</code></pre>

python python-3.x