text_plain_output_1.png
def search(arr, n, x):
    for i in range(0, n):
        if arr[i] == x:
            return i
    return -1
arr = [10, 20, 30, 40, 50, 60, 70]
x = 50
n = len(arr)
result = search(arr, n, x)
if result == -1:
    print('Elemen tidak ada di array')
else:
    print('Elemen ada di indeks', result)