Answered step by step
Verified Expert Solution
Question
1 Approved Answer
How would you complete the following in Python? Function name: help_recruit Parameters: A string Return value: A tuple of length 3 Description: Write a function
How would you complete the following in Python?
Function name: help_recruit Parameters: A string Return value: A tuple of length 3 Description: Write a function that takes in a string that holds the information of a recruit. You may assume that the string will always be formatted in this way: "NAME: SPORT, RANK". Return a tuple in the format (SPORT (string), RANK (int), NAME (string Please note there is a space before SPORT. The tuple that is returned must not have any spaces within the strings Test Cases >>>test1 -help_recruit("Joseph Macrina: Football, 1") >> print (test1) Football', 1, 'Joseph Macrina >>>test2-help_recruit("Chris Eubanks: Tennis, 8") >> print (test2) 'Tennis', 8, 'Chris Eubanks') >>>test3-help_recruit("Ashley Askin: Volleyball, 6" >> print (test3) ('Volleyball', 6, 'Ashley Askin') Function name: recruiting profile Parameters: A list of strings, sport_name Return value: A list of tuples Description: Write a function that takes in a list of strings. The list can be empty, in which case return an empty list. Each string contains information about a person. You may assume that the string will always be formatted in this way: "NAME: SPORT, RANK". Call the help_recruit function to convert each string to a tuple. Find all the tuples that have sport_name and add them to a list sorted by their rank. However, the tuples in this list should be formatted as (RANK(int), SPORT(string) NAME(string)). No one will have the same rank. Return the list. Notes If you have a function that returns a tuple of length three another way you can call the function and store the returned values is myfunc() When sorting the tuples, you may use a built-in function a, b, c Test Cases >>> recruits-recruiting_profile(["Jair Anderson: Football,4", "TaQuon Marshall: Football, 1", "Daniel Yun: Tennis, 3", "Gabby Benda: Volleyball, 7", "Ashley Askin: Volleyball, 2", "Sydney Wilson: Volleyball, 5", "Chris Eubanks: Tennis, 1", "Zach Matthews: Football, 11", "Andrew Li: Tennis, 2"], "Tennis" >>>print (recruits)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