Write a UDF in python, it will take two arguments list(sequence of elements) and finding element . Function search and return 1 if element is present in the given list otherwise return -1 .( using linear search)
Answers
Answered by
1
Answer:
find = lambda sequence, element: 1 if element in sequence else -1
It can also be written as:
def find(sequence, element):
if element in sequence:
return 1
else:
return -1
Similar questions