Ask coding questions

← Back to all posts
Python | Generating a system to create different variables

Hello, as I was working on this side project, I hit a roadblock : the inability to come up with an idea to generate an infinite amount of variables that could contain different values as it could be used for when a user decides to have add more than 10 variables that they would like to fill out. I think that instead of adding 10+ variables that could have an individual input from a user that would be later converted to a integer, I personally think that it would be a lot better (for the user) to be able to input a number into a variable in order to select how many extra variables they could fill out.

Example :
x = int(input("How many extra slots would you like to fill in? : "))
extra code I do not know

[ Thanks for attempting to answer this question. Much appreciated. ]


You could be looking for lists;


or eval-ing a bunch of variables;