Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
326 B
2
Indexable
Never
def check_frequency(numbers):
  number_count = {}

  for num in numbers:
      if num in number_count:
          number_count[num] += 1
      else:
          number_count[num] = 1

  for num, count in number_count.items():
      print(f"{num} xuất hiện {count} lần")

numbers = [1,1,1,2,2,4,2,5]
check_frequency(numbers)