Question: ONLY Task 5 . 1 #my module script to be inlcuded in main program 2. 3 #example function to be imported 4 def print_name(first, last


1 #my module script to be inlcuded in main program 2. 3 #example function to be imported 4 def print_name(first, last = None): if last: print('Hello, {first} {last}!') else: 8 print('Hello, {first}!') 9 10 def sum_score(list): 11 12 For a provided numeric list, 13 sum the values and return the result. 14 15 #HINT: look up the documentation for a 'function return 16 #INSERT YOUR CODE HERE 17 I. This script simulates the results of a job entrance exam where applicants complete tests and receive scores. Your task here is to complete the code required to intake the results of the test, report the results and make hiring recommendations based on the test results. import random random. seed (123) num_applicants = 100 num_questions = 20 #results from the 20-question exam results_sheet = [] for student in range(num_applicants): #generate scores for each student and append to results sheet scores = random.choices (list(range(0,6)), k=num_questions) results_sheet.append(scores) #The result here is a list of lists. #print out the first row of scores just as an example print(results_sheet[@]) #Task 1: write a method in an external module and import it into this script The my_module.py file contains a sample function that you can import into this program This could look like: from my_module import print_name You need to write the code for the function sum_score) and use it to sum the values in results_sheet #IMPORT CODE HERE #CODE TO SUM AND REPORT THE TOTAL RESULTS #totals should be a list of length - 'num_applicants with the totals for each applicant #HINT: you will need a for-loop here totals - 11 #Task 2: Use try-except to check for an error with a list data type next_applicant contains values that don't make sense to add up maybe as a result of a typing mistake? next_applicant = [0,4,2,3,'0',5,1,2,4,4,2,3,'0',4,5,'0', 1,2,3,4) Use the module and function from task 1 above to try and sum the values in "next_applicant' and show that an error is returned. HINT: You will need to identify what is wrong with "next_applicant' in the code. We can see that there are the letter 'o' in the list instead of number, but you need to help the program recognize that. #TASK 2 CODE HERE #Task 3: Use if-else and elif to filter lists results sheet has a total of 100 summed values in it now, representing the scores on a job entrance exam. You now need to do two things: -Add an index to the list, i.e. the first applicant should be number 1, and so on. -filter all the applicants into categories -the categories are represented as lists: 'make_an_offer', 'waitlist', 'no_offer -the minimum scores for being included in each - make_an_offer': 60 . #Task 3: Use if-else and elif to filter lists results_sheet has a total of 100 summed values in it now, representing the scores on a job entrance exam. You now need to do two things: -Add an index to the list, i.e. the first applicant should be number 1, and so on. -filter all the applicants into categories -the categories are represented as lists: 'make_an_offer', 'waitlist', 'no_offer -the minimum scores for being included in each - make an offer': 60 -'wait list': 50 -"no_offer':
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
