So I got the following problem. Let's say I want to make a game and therefore I have a list of players. To work with this players and give them several attributes I create a Players
class. Now I want to automatically paste every player in my list as a separate instance in my Players
class.
class Players:
def __init__(self, name):
self.player_name = name
players_arr = ['Testplayer1', 'Testplayer2', 'Testplayer3']
# Testplayer1 = Players(name = players_arr[0])
# Testplayer2 = Players(name = players_arr[1])
# Testplayer3 = Players(name = players_arr[2])
Any idea how I could automate the process commented out? I basicly want to create this class because everyone has a counter (imagine like a death counter) and of course it has to tick separately.