In: Computer Science
Python.
The array C has multibel peaks (+ , -). write a code that detect
the vlaues of all those peaks.
C = [0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.0011
-0.0031
0.0011
0.0034
-0.0039
0.0004
0.0052
-0.0045
-0.0025
0.0067
-0.0038
-0.0034
0.0077
-0.0034
-0.0054
0.0076
-0.0011
-0.0063
0.0068
0.0004
-0.0084
0.0061
0.0037
-0.0086
0.0018
0.0063
-0.0045
-0.0069
0.0078
0.0027
-0.0132
0.0054
0.0133
-0.0131
-0.0060
0.0180
-0.0037
-0.0169
0.0140
0.0128
-0.0210
0.0048
0.0218
-0.0158
-0.0134
0.0216
-0.0004
-0.0205
0.0121
0.0126
-0.0197
-0.0031
0.0186
-0.0130
-0.0115
0.0160
-0.0010
-0.0114
0.0091
0.0026
-0.0087
0.0035
0.0043
-0.0047
0.0002
0.0025
-0.0015
-0.0006
0.0011
0.0002
-0.0006
-0.0004
0.0008
-0.0002
0
0
0
0
0
0
0
0
0
0
0]
C = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-0.0031, 0.0011, 0.0034, -0.0039, 0.0004, 0.0052, -0.0045, -0.0025, 0.0067, -0.0038, -0.0034, 0.0077, -0.0034, -0.0054, 0.0076, -0.0011, -0.0063, 0.0068, 0.0004, -0.0084, 0.0061, 0.0037, -0.0086, 0.0018, 0.0063, -0.0045, -0.0069, 0.0078, 0.0027, -0.0132, 0.0054, 0.0133, -0.0131, -0.0060, 0.0180, -0.0037, -0.0169, 0.0140, 0.0128, -0.0210, 0.0048, 0.0218, -0.0158, -0.0134, 0.0216, -0.0004, -0.0205, 0.0121, 0.0126, -0.0197, -0.0031, 0.0186, -0.0130, -0.0115, 0.0160, -0.0010, -0.0114, 0.0091, 0.0026, -0.0087, 0.0035, 0.0043, -0.0047, 0.0002, 0.0025, -0.0015, -0.0006, 0.0011, 0.0002, -0.0006, -0.0004, 0.0008, -0.0002, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] print("Data we have: ") print(C) print("\n") min = 0 max = 0 for i in C: if i>max: #If current value is greater than positive peak max = i #current value is the new peak if i<min: #if current value is less than negative peak min = i #curernt value is the new peak print("Positive peak: ") print(max) print("Negative paeak: ") print(min) sum = 0 for i in C: if i==max or i==min: sum += abs(i) print("Final sum: ", end="") print(sum)