Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How my book and my python have different values on this "set" variable?

so, in my book state that:

dict1 = {'satu': 100, 'dua': 100, 'tiga': 100, 'empat':200}
set1 = set(dict1)
set1
{'tiga', 'dua' 'empat' 'satu'}

and while i try it, the code says:

dict1 = {'satu': 100, 'dua': 100, 'tiga': 100, 'empat':200}
set1 = set(dict1)
set1
{'satu', 'dua' 'empat' 'tiga'}

am i mising something?
My code here[text]
Book Code description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

In the documentation it clearly says that:

A set is an unordered collection with no duplicate elements.

So the order doesn’t count, the only thing that matters, in your case, is that the elements of the set are the same as the ones displayed in the book.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading