text_plain_output_1.png
import numpy as np

import numpy as np
np.random.seed(100)
arr = np.random.randint(1, 11, size=(6, 10))
arr

r, c = np.shape(arr)
r

arr = np.ones((10, 10))
arr[0:-1:2, 0:-1:2] = 0
arr

Input: np.array([1, 2, 9, 1, 3, 7, 1, 2, 10])

arr2 = np.array([1, 2, 9, 1, 3, 7, 1, 2, 10])

for i in range(len(arr2)):
    try:
        if arr2[i] > arr2[i - 1] and arr2[i] > arr2[i + 1]:
            print(arr2[i])
    except:
        print('')