def frequent_antennas(positions, percentage=0.8):
    """
    The number of location that account for 80% of the locations where the user was.
    Percentage can be supplied as a decimal (e.g., .8 for default 80%).
    """
    location_count = Counter(list(map(str, positions)))

    target = math.ceil(sum(location_count.values()) * percentage)
    location_sort = sorted(list(location_count.keys()),
                           key=lambda x: location_count[x])

    while target > 0 and len(location_sort) > 0:
        location_id = location_sort.pop()
        target -= location_count[location_id]

    return len(location_count) - len(location_sort)
def frequent_antennas ( positions , percentage = 0.8 ) : location_count = Counter ( list ( map ( str , positions ) ) ) target = math . ceil ( sum ( location_count . values ( ) ) * percentage ) location_sort = sorted ( list ( location_count . keys ( ) ) , key = lambda x : location_count [ x ] ) while target > 0 and len ( location_sort ) > 0 : location_id = location_sort . pop ( ) target -= location_count [ location_id ] return len ( location_count ) - len ( location_sort )
The number of location that account for 80% of the locations where the user was.
    Percentage can be supplied as a decimal (e.g., .8 for default 80%).