DEV Community

Tommi k Vincent
Tommi k Vincent

Posted on

Accessing Values in a Set in Python.

we cannot access individual values in a set but we can all access all the elements together.

Enter the following code to try and access sets in python.

players = set(['Madueke','Reece James','Cole Palmer','Raheem Sterling','Levi Colwil','Thiago Silva',
'Mudryk','cucurella','Nkunku Christopher'])

for player in players:
    print(player)
Enter fullscreen mode Exit fullscreen mode

output
When the above code is executed, it produces the following result:

Thiago Silva
Reece James
Levi Colwil
cucurella
Mudryk
Raheem Sterling
Cole Palmer
Enter fullscreen mode Exit fullscreen mode

Top comments (0)