Question: I am currently trying to use the built in function Sorted to sort a list with a class attribute called scores.

Here the sorted function works with just a list, it correctly orders the scores in ascending order.

```
Scores = [1,5,19,0,900,81,9000]

print(sorted(Scores))

```

However when I try to apply this function to my list which has a class attribute, An error is returned:
AttributeError: 'list' object has no attribute 'Score'

Here is my code:

```
print(sorted(RecentScores.Score))

```

Any help would be much appreciated.

Below is my class being initialised and the list RecentScores

```
class TRecentScore():
  def __init__(self):
    self.Name = ''
    self.Score = 0

RecentScores = [1,5,0]

```

Answer: 
You're not using your class what you're actually doing is just declaring a list with some numbers inside and then you're trying to call the attribute `Score` on that list object.

```
class TRecentScore():
    def __init__(self, name, scores):
        self.name = name
        self.scores = scores

recent_scores = TRecentScore('Sorted Scores', [1,5,0])
print(sorted(recent_scores.scores))

```
If you always want your scores list sorted, you can sort the list in place, using sorted creates a new list:

```
class TRecentScore():
    def __init__(self, name, score):
        self.Name = name
        self.score = score
        self.score.sort()

RecentScores = TRecentScore("score list", [1,5,19,0,900,81,9000])
print (RecentScores.score)
[0, 1, 5, 19, 81, 900, 9000]

```