Question: Write a function countPeaks() that takes a tuple as parameter, finds and returns the number of peak values in the tuple. A peak value is
Write a function countPeaks() that takes a tuple as parameter, finds and returns the number of peak values in the tuple. A peak value is greater than its predecessor and its successor. Assume that the tuple contains numbers. Example: (4, 2, 5, 7, 6, 6, 4, 3, 5, 2, 6, 7) has 2 peaks, the first 7 and the second 5. Both of these values are greater than their predecessor and their successor
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
