Python Program To Check Element Exist or Not
def check_element_in_array(array, element):
if element in array:
return True
else:
return False
# Example usage:
my_array = [1, 2, 3, 4, 5]
element_to_check = 3
if check_element_in_array(my_array, element_to_check):
print(f"{element_to_check} exists in the array.")
else:
print(f"{element_to_check} does not exist in the array.")
Output 1:
3 exists in the array.