The output is in a different order. Why?

+1 Shlesh Tiwari · November 9, 2015
names={'Terry', 'Hazard', 'Ivanovic', 'Terry', 'Costa','Hazard','Costa'}

print names

Ouput = set(['Costa', 'Ivanovic', 'Hazard', 'Terry'])


Why are the names not in the order as I entered them in the original list? Please help. 

Thanks

Post a Reply

Replies

Oldest  Newest  Rating
+1 Jeff the Killer · November 9, 2015
>>> names=['Terry', 'Hazard', 'Ivanovic', 'Terry', 'Costa','Hazard','Costa']


use []for lists brackets for dictionaries or you could use tuples
+1 Halcyon Abraham Ramirez · November 9, 2015
Sets are unordered
0 Shlesh Tiwari · November 9, 2015
Ah okay! Thanks Halcyon Abraham Ramirez. 

Jeff the Killer: How do I use tuples?
0 Jeff the Killer · November 10, 2015
Bucky's python 2 tutorial
  • 1

Python

107,349 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator