I want to create variables as a1,a2,a3…a10. For that I used a for loop. As the variable in loop increments I need to create a variable as above.
Can anyone give me an idea?
At the time of creation I also need to be able to assign values to them.
That’s where I’m getting syntax error.
Following what S.Lott said, you can also use a dict, if you really nead unique names and that the order of the items is not important:
I would add that this is very dangerous to automate variable creation like you want to do, as you might overwrite variables that could already exist.