user
You need to complete the following task:

Write a function to search a given array for a particular number.

array = [5, 10, 20, 25, 40]
target = 20

Answer:
assistant
"""
This function searches an array for a particular number and returns an index if it is found. 

def search_array(arr, target): 
  for i in range(len(arr)): 
    if arr[i] == target: 
	  return i
 
  return -1
 
# Driver code 
array = [5, 10, 20, 25, 40] 
target = 20
index = search_array(array, target) 
 
if index != -1: 
  print("Element found at index", index) 
else: 
  print("Element not found") 
"""