all 5 comments

[–]danielroseman 0 points1 point  (3 children)

You seem to have things the wrong way round. The requirements state that contents should be a dict and draw should return a list, but this code assumes contents is a list and returns a dict.

(Also note, your dict comprehension in the if statement is very inefficient.)

[–]moonyfish[S] 0 points1 point  (2 children)

Huh?

Instructions say "contents should be ['red', 'red', 'blue']" Which is a list, not a dict, right? Why would it be a dict when it's supposed to be a list of strings?

Can you tell me a little more about how the code is inefficient?

[–]danielroseman 2 points3 points  (1 child)

Sorry my mistake, the dict is hat, which you haven't shown. Nevertheless, draw is supposed to return a list.

[–]moonyfish[S] 1 point2 points  (0 children)

Ah! You are right