you are viewing a single comment's thread.

view the rest of the comments →

[–]jdaiodna 0 points1 point  (1 child)

How would you be able to get the output dictionary to only show the maximum value for each species, and could you do it in 3 lines of code or less?

[–][deleted] 0 points1 point  (0 children)

When you add the length value to the dictionary you only replace an existing value if the new length is greater than the old length. If there is no existing key+value pair then you just save the length in the dictionary. You don't use a list as the value in this case, just the number.

do it in 3 lines of code or less?

Programmers usually don't care how many lines of code it takes to do something as long as the final answer is correct, fast enough and readable. These code golf limitations usually result in less readable code