L. Kappa L. Kappa - 6 months ago 23
Python Question

Menu in python / Automatic variables?

I'm working on a program but I'm stuck. I have created a menu with multiple options. Now I'm wondering is it possible to automatically create variables if you add a team. I.E.: normally you would enter the variable at the top and do it like teamA = input. Is it possible to do this automatically without any given variables and use of a database?

while loop:
LAN-Party 2017:

1. Add a team.
2. Look at the teams.
3. Look at the scores for the teams.
4. Add scores for the team.
5. Quit.
loop=input("What do you want to do?")
if loop=="1":
#what goes here?

I've tried looking around on google and on this site but couldn't find anything. Also sorry for the vague description, this is the best I could do.
Thanks in advance :)


Lets say this variable you want is just a team name, you could just put all the team names in a list, and if you need to refer to them, you could do so by indexing.

teams = []
if loop == 1:
    team = input("enter team name")

Personally, I would make a team class that could hold things like members, score, or whatever you want.