How to find peaks & eliminate flat tops

rogernm001:
where they repeat and print each repeated value as a peak point which is false

Write down on paper step by step your thought process, ie. what decisions you make, to determine what constitutes a 'flat top' and why repeated peaks are incorrect. That's the germ of your algorithm.