sorry, the extra curly braces were added by mistake - I already edited my answer when I saw them.
But anyway I misunderstood your goal ( I thought you want to print string), so just ignore it
It looks like you try to create variables dynamically, e.g. you want to assign the result of
You should use use proper data structure instead
predictions dict would look like
Of course you can have single dict of dicts with both predictions and params in the neseted dicts
e.g. results dict would look like
But anyway I misunderstood your goal ( I thought you want to print string), so just ignore it
It looks like you try to create variables dynamically, e.g. you want to assign the result of
get_predictions(2005, 12)
to predictions_2005
and parameters_2005
You should use use proper data structure instead
predictions = {} parameters = {} for year in range(2005, 2008): prediction, param = get_predictions(year, 12) predictions[year] = prediction parameters[year] = paramThis way you will get a dict with predictions and dict with params.
predictions dict would look like
{2005:<some value>, 2006:<some value>, 2007:<some value>}
Of course you can have single dict of dicts with both predictions and params in the neseted dicts
e.g. results dict would look like
{2005:{'predictions':<some value>, 'params:<some value>}, 2006:{'predictions':<some value>, 'params:<some value>}, 2007:{'predictions':<some value>, 'params:<some value>}}
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs