Question: Python Please!!!!! Write a Python program function that uses a list of integers, test_list, and prints a list a list of peaks, which are numbers
Python Please!!!!!

Write a Python program function that uses a list of integers, test_list, and prints a list a list of peaks, which are numbers that are strictly greater than both of its neighbors. IMPORTANT NOTES: the first and last values can not be peaks; the peaks should be in the order they appear in the original list; the same value might be a peak in multiple places in the original list; there might be no peaks, in which case you should simply return an empty list. Sample Inputs/Outputs: Example 1: test_list = [1, 2, 3, 2, 1] Expected Output: [3] because: -3>2 and 3 > 2. Example 2: test_list = [10, 2, 20, 3, 4, 4, 5, 8, 4, 5, 1] Expected Output: [20, 8, 5] because: 20 > 2 and 20 > 3; 8 >5 and 8 > 4; 5> 4 and 5 > 1. 296528.1655254.qx3zqy7 LAB ACTIVITY 13.42.1: Find Peaks (Loops - Medium) 0/11 Current file: test_data.py Load default template... 1 #This module creates the test_list to be used in main.py 2 #Reads input_values from the user & places them into test_list 3 test_list = [int(i) for i in input().split(", "]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
