[Python] Select keys with highest values in python map

Discussão em 'Python' iniciado por Stack, Agosto 9, 2025.

  1. Stack

    Stack Membro Participativo

    I have the following Python map :

    mapA = {
    11623.086573146293: 0.01108027,
    11638.665330661323: 0.02080624,
    11652.918236472946: 0.02274327,
    11675.291983967936: 0.01589522,
    11697.334268537074: 0.00065645
    }


    I need to return a list containing the two keys with the highest values. From the example above, that would be:

    [11652.918236472946, 11638.665330661323]


    How can I do that in Python?

    Continue reading...

Compartilhe esta Página