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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!