Your question is Second Biggest Value in Objects. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
An Mphasis Helix workflow receives a list of objects representing ranked items. Each object contains a numeric field such as score, priority, or rating. Return the first object whose field value is the second-highest distinct value in the list.
Use a single pass when possible. If several objects share the second-highest value, return the one appearing first in the input list.
Implement second_largest_object(objects, key).
objects is a non-empty list of dictionaries.key is a string naming a field present in every dictionary.objects[i][key] is an integer.key.def second_largest_object(objects, key):