Skip to content

Latest commit

 

History

History
28 lines (24 loc) · 706 Bytes

File metadata and controls

28 lines (24 loc) · 706 Bytes

What Did I Learn?

In this challenge I learned:

  1. How to create a dict with the number of times each number appears
frequencies = {}
for num in nums:
    if num in frequencies:
        frequencies[num] += 1
    else:
        frequencies[num] = 1
  1. Discovering the highest frequency (using the Max function to compare 2 numbers).
max_frequency = 0
for frequency in frequencies.values():
    max_frequency = max(max_frequency, frequency)
  1. Seeing how many times the greatest frequency is repeated in the dict
frequency_of_max_frequency = 0
for frequency in frequencies.values():
    if frequency == max_frequency:
        frequency_of_max_frequency += 1