Question: I need to define a function called searchNames(searchString): that will accept the search and check if the string is a part of any of the
I need to define a function called
searchNames(searchString): that will accept the search and check if the string is a part of any of the tuples. If so, the tuple should be printed out if it corresponds with the word searched. Search should NOT be case sensitive. Thanks!
Example:
name_info = [('Anne', '18', 'freshman'),
('Jerry', '21', 'Senior'),
('Sally', '18', 'Freshman'),
('Frank', '22', 'SENIOR')]
def searchNames(searchString) :
??? (dont know what to put here)
searchNames('senior')
print("...........................")
searchNames('18')
print("...........................")
searchNames('jerry')
print("...........................")
Example output:
('Jerry', '21', 'Senior')
('Frank', '22', 'SENIOR')
....................................
('Anne', '18', 'freshman')
('Sally', '18', 'Freshman')
....................................
('Jerry', '21', 'Senior')
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
