tmi12 tmi12 - 1 month ago 14
Python Question

Python 2.7.10 class object list

Is it possibly to make 'self.elo' object a list (or maybe vector?), which has every single data point on it.

class Joukkue:
def __init__(self, name, games, elo):
self.name = name
self.games = games
self.elo = elo


I'm currently just changing the values into new ones, but I would like to see the development of teams rating(elo) and maybe visualize it aswell. This is how I do this currently:

lista = {}
lista[ID1].elo = a
lista[ID2].elo = b


This is just part of my code and I can post the whole .py file if needed.

Answer

If I understood your question correctly you want to make self.elo a list. I believe this is possible this way:

self.elo = [items, in, here]