Write a python program to search a particular character from the string using linear search method.
Answers
Answered by
1
Python Program
Explanation:
def linearSearch(list,find):
for i in range(len(list)):
if list[i] == find:
return True
return False
# list
list = [89, 52, 'python', 84,'hey', 906]
# Driver Code
character = 'hey'
if linearSearch(list, character):
print("Search successfull!!!")
else:
print("Not successfull!!!")
Output
Search successfull!!!
Similar questions