• Statistics Module

Question related to mission Sort Array by Element Frequency

 
import statistics as stat


def frequency_sort(items):
    if len(items) <= 1:
        return items

    item_freq = []
    while len(items) >= 1:
        num = stat.mode(items)
        freq = items.count(num)
        for _ in range(0, freq):
            item_freq.append(num)
            items.remove(num)
    return item_freq

I have to go and see how/why that one liner LAMBDA code works because looking at it, I don't understand ... then again, I'm early on and haven't used lambda or the sorted() built-in at all, really.