This is my list:
premier_league = [
['Manchester City', '1', 'Aguero'],
['Manchester City', '1', 'Mahrez'],
['Manchester City', '1', 'Sterling'],
['Liverpool', '2', 'Mane'],
['Liverpool', '2', 'Salah'],
['Liverpool', '2', 'Jota'],
['Chelsea', '3', 'Ziyech'],
['Chelsea', '3', 'Werner'],
['Chelsea', '3', 'Abraham']
]
I'm trying to get a new list which contains only the name of the football clubs once. This is my code:
clubs = []
for club in premier_league:
clubs.append(club[0])
print(clubs)
This is my output:
['Manchester City', 'Manchester City',
'Manchester City', 'Liverpool',
'Liverpool', 'Liverpool',
'Chelsea', 'Chelsea', 'Chelsea']
This is my desired output
['Manchester City', 'Liverpool', 'Chelsea']