I am making a voting system with python 3 and I get the candidates for each position based on user input through tkinter. For the sake of this example I won't be using tkinter as it is unnecessary.
I have my candidates stored inside of lists when they are created. Since the user can create as many candidates as they want there is no way of knowing how many variables I need for the counting process. That is why I believe I need to use a for loop to create variables. How can I do that?
posOne = []
f = [x.strip() for x in candidates.split(',')]
for x in f1:
posOne.append(x)
for z in posOne:
#code to create a new variable
Then I'll need a way to target the created variables so when they receive a vote I can count +1
If you know of a better way to handle this please let me know, because this doesn't seem optimized