Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Day9: working with dictionaries #7

Closed
blakeaa827 opened this issue Apr 26, 2018 · 3 comments
Closed

Day9: working with dictionaries #7

blakeaa827 opened this issue Apr 26, 2018 · 3 comments
Assignees
Labels

Comments

@blakeaa827
Copy link

Hey there,

Having a hard time following instructions for day 9. Dictionaries are unsorted. So printing out the nth dictionary entry doesn't make sense to me. Since the dictionary is in alphabetical order in data.py, I assumed this means that is the "order" the instructions are referring to. So I generated a new dictionary with the index as the key.

However, the last instruction says to replace the key in the nth position of the dictionary with the value from the nth position in the list. However, that would create a duplicate key in the dictionary and doesn't work.

Please let me know if I'm completely missing something here!

Thanks very much!
-Blake

@hobojoe1848 hobojoe1848 self-assigned this Apr 27, 2018
@hobojoe1848
Copy link
Collaborator

Hi Blake!

Thanks for pointing this out mate.

Firstly, correct! Dictionaries are unsorted, so the idea is to intentionally sort this dict by key and then grab the nth key/value as per the instructions. Even though data.py is "sorted" in alphabetical key order, there's no guarantee that's the order you'll get when parsing it.

As for swapping the nth dict key with the nth list value... I've been over zealous so thank you (seriously) for raising this as an issue! I'm going to strip that out of the readme for now.
We're working on an additional Bite to add in for this which should make up for my oversight.

Keeping this issue open while we work on the Bite.

Thanks again mate!
Cheers,
Julian

@blakeaa827
Copy link
Author

Hey Julian,
Thanks for the feedback. Really enjoying the course! Keep up the great work!
-Blake

@hobojoe1848
Copy link
Collaborator

Hi Blake! Check out the readme now. We've left the manual steps but have created a new Bite on the codechalleng.es platform that's a good (better) replacement.

https://codechalleng.es/bites/promo/listvsdict

Hope that helps man!

Let us know if otherwise.

Thanks!
Julian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants