In: Computer Science
Create the logic for a program that stores 5 names in an array.
Your program will then ask the user which name (s)he wants to search. The program receives the name to be searched as input and searches the array for the name entered.
If the name is one of the names in the array, display the message "Name found.". Otherwise, display the message "Name not found.".
in pseudocode please in python
Note : plz follow the space indentation as per in the screenshot so that ur program works perfectly.
Could you plz go through this code and let me know
if u need any changes in this.Thank You
_________________
__________________________
def search(list,searchword):
for i in range(len(list)):
if list[i] == searchword:
return True
return False
list = ['rahul', 'kevin', 'sachin', 'peter','bob']
searchword=input("Enter name to search: ")
if search(list, searchword):
print("Name found")
else:
print("Name not Found")
______________________________
Output:
___________________________
Output#2
_______________Could you plz rate me well.Thank
You