I import data from excel, and I have two condition for it

(1) let grasshopper select the most repeated value if there are three repeated value or more

(2) let grasshopper selected the highest value for else value.

For example, I have 20, 20, 20, 40. There are three repeated value, so go to condition (1). The result is 20. Second example, I have 40, 40, 50, 100. There are less than three repeated value, so go to condition (2). The result is 100.

Here is the scrip I wrote for (2) but I don’t know how to add another condition and what would be a script for (1). Any suggestion please? Try to do GHpython script but my script is not work.