DEV Community

I'm Just a Guy with a Computer
I'm Just a Guy with a Computer

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)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more