+ 1

How to access element from sets in Python?

courses = {'Math', 'Science', 'Art'}

9th Jul 2018, 8:19 AM
Aakash Gupta
Aakash Gupta - avatar
12 Antworten
+ 4
In wich language? Please write a more clear question to get faster answers.
9th Jul 2018, 8:32 AM
Michael55555
Michael55555 - avatar
+ 4
Aakash Gupta You're welcome!
9th Jul 2018, 9:12 AM
Michael55555
Michael55555 - avatar
9th Jul 2018, 8:53 AM
Michael55555
Michael55555 - avatar
+ 3
https://stackoverflow.com/q/59825/9541900
9th Jul 2018, 9:03 AM
Michael55555
Michael55555 - avatar
+ 1
done check it out... I am asking for python
9th Jul 2018, 8:52 AM
Aakash Gupta
Aakash Gupta - avatar
+ 1
there is no answer what I asked.. if I want it's first element then how we can access?
9th Jul 2018, 8:58 AM
Aakash Gupta
Aakash Gupta - avatar
+ 1
yes! I want help.
9th Jul 2018, 9:09 AM
Aakash Gupta
Aakash Gupta - avatar
+ 1
courselist=sorted(list(courses)) I normally change it into a sorted list. Then you know, there are no duplicates and they are all in alphabetical order. courselist[0] will give 'Arts' Other way. for course in courses: print(course)
9th Jul 2018, 10:33 AM
Louis
Louis - avatar
0
anyone wanna link
9th Jul 2018, 9:07 AM
its not bullying if you do it once
its not bullying if you do it once  - avatar
0
Michael Peters thanks it's help.. way is a little different but helpful.
9th Jul 2018, 9:10 AM
Aakash Gupta
Aakash Gupta - avatar
0
pardon ! didn't understand
9th Jul 2018, 9:12 AM
Aakash Gupta
Aakash Gupta - avatar
0
yes! and thank you 😊 Louis
9th Jul 2018, 10:38 AM
Aakash Gupta
Aakash Gupta - avatar