About set in python. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

About set in python.

Hello Can we sort a set wich contain words ? For example i have a={'z','h' ,'u' ,'k','d','a'......} How To sort it in the alphabet order?

26th Dec 2019, 4:45 PM
iren yeger
iren yeger - avatar
2 Answers
+ 7
You can not sort a set, you can only create a sorted list of the elements in a set, like Alexandr showed.
26th Dec 2019, 5:23 PM
HonFu
HonFu - avatar
+ 2
Thank you Alexandr HonFu
26th Dec 2019, 5:26 PM
iren yeger
iren yeger - avatar