No, you don't dynamically create variables like that. If you want a collection of things, use a collection - you can have a list of dictionaries of course.
Of course your code does that. On line 4, you set the value of
Of course your code does that. On line 4, you set the value of
dictionary_name
to an empty dict, overwriting what was in there before. Line 3 doesn't even create a variable with the name X0
for example - it just sets the value of the variable to be that string. Both lines 3 and 4 are doing the same kind of thing - assigning a value to a variable. How could the same syntax be used for that and creating variable names dynamically? It couldn't, because the interpreter wouldn't be able to guess which one you meant.