انا حلت بلغه الباثيون وباستخدم Binary Search
arr = [2,3,4,10,40]
start = 0
end = len(arr) - 1
n = 10
while start <= end:
mid = start + (end - start) // 2
if n == arr[mid]:
print(f"index: {mid}")
break
elif n > arr[mid]:
start = mid + 1
elif n < arr[mid]:
end = mid - 1
تمام , شكرااا جدا لحضرتك