HTMLify
mode.py
Views: 518 | Author: abh
1 2 3 4 5 6 7 8 9 10 11 12 13 | def mode(numbers): if not numbers: return [] mode = [] max_count = 0 for num in numbers: count = numbers.count(num) if count > max_count: max_count = count mode = [num] elif count == max_count and num not in mode: mode.append(num) return mode |