Что мне нужно решить это:Создайте список класса и доступ к нему из другого класса
Create class "Scores" and "Player".
Class score should have attributes level, score, time.
Class player should have as information a name and a list of Scores,
In class player implement the method maxLevel(),
which returns the max level achieved by the player.
Я чувствую, что это несколько очень легко, но я до сих пор не могу понять это.
- Как я могу составить список баллов точно?
- Как только это будет сделано, как мне получить доступ к списку баллов для каждого игрока?
Спасибо!
Я пробовал это, но я просто знаю, что я делаю что-то не так.
class Score():
level = 0
score = 0
time = 0
def __init__(self,level,score,time):
Score.level = level
score.score = score
Score.time = time
class Player():
def __init__(self, name, scores):
self.name = name
self.scores = scores
def maxLevel():
##Do stuff to calculate the max
John = Player("John", [Score(100,1456,50), Score(210,1490,100)])
John.maxLevel()
Пожалуйста, покажите, что вы исследовали, и что вы пробовали. –
Отредактировано, это должно быть ужасно, я настоящий начинающий, спасибо! – Alejo