Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started