educative.io

What is the difference between answer B and C in question 3 in this quiz?

Hello,
what is the difference between answer B {‘b’: 2, ‘c’: 3, ‘a’: 0} and C {‘a’: 0, ‘b’: 2, ‘c’: 3} in question 3 in this quiz?
I don’t see any?
Best regards
Miguel


Course: Educative: Interactive Courses for Software Developers
Lesson: Educative: Interactive Courses for Software Developers

Hi @Miguel_Alves,

Yes, you are right; when we see this as a key-value pair, there is no difference in both options. But when we look at the dictionary level or the arrangements of the key-value pairs, we can treat them as different because the output of the code will be option C, as the zip function takes the first element from the keys list and assigns it the first value from the values list, and so on.

I hope I have answered your query; please let me know if you still have any confusion.

Thank You :blush: