Preview:
freq = {3: 3, 2: 6, 1: 4}
k = 2

sort_orders = [k for k in sorted(freq, key=freq.get, reverse=True)[:k]]
print(sort_orders)

# Output [2, 1]
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter