Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Converting set to list

planets = {'Mars', 'Jupiter', 'Saturn', 'Mercury', 'Venus', 'Earth', 'Mars'}
print(planets)

planets_list = list(planets)
print(planets_list)

Output:

{'Jupiter', 'Mars', 'Earth', 'Saturn', 'Venus', 'Mercury'}
['Jupiter', 'Mars', 'Earth', 'Saturn', 'Venus', 'Mercury']