大宮盆栽デイズ - Omiya Bonsai Days -

冗談めかす埼玉のファインマン

@CheckiO@Best Stock

def best_stock(data):
    value_sorted = sorted(data.items(), key=lambda x:x[1])
    return value_sorted[-1][0]



if __name__ == '__main__':
    print("Example:")
    print(best_stock({
        'CAC': 10.0,
        'ATX': 390.2,
        'WIG': 1.2
    }))

    # These "asserts" are used for self-checking and not for an auto-testing
    assert best_stock({
        'CAC': 10.0,
        'ATX': 390.2,
        'WIG': 1.2
    }) == 'ATX', "First"
    assert best_stock({
        'CAC': 91.1,
        'ATX': 1.01,
        'TASI': 120.9
    }) == 'TASI', "Second"
    print("Coding complete? Click 'Check' to earn cool rewards!")