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

Only TASK 5 please.
Only TASK 5 please. 1 #my module script to be inlcuded in
main program 2. 3 #example function to be imported 4 def print_name(first,
last = None): 5 if last: 6 print (f 'Hello, {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): 5 if last: 6 print (f 'Hello, {first} {last}!') 7 else: 8 print(f '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 JOUAWNHO 171 36 14 This script simulates the results of a job entrance exam where applicants 15 complete tests and receive scores. 16 17 Your task here is to complete the code required to intake the results of the test, 18 report the results and make hiring recommendations based on the test results. 20 import random 21 randon. seed (123) 22 num_applicants = 100 23 num questions = 20 24 #results from the 20-question exam 25 results_sheet = 1 26 for student in range(num_applicants): 27 #generate scores for each student and append to results sheet 28 scores - random.choices(list range(0,6)), kanun questions) 29 results_sheet.append(scores) 30 #The result here is a list of lists. 31 32 #print out the first row of scoles just as an example 33 print (results_sheet[0]) 34 35 Task 1: Write a method in an external module and import it into this script 37 The my.module.py file contains a sample function that you can import into this program 38 This could look like: 39 from my_module import print_name 40 41 You need to write the code for the function sum_score() and use it to sum the values in results_sheet 42 43 #IMPORT CODE HERE 44 45 #CODE TO SUM AND REPORT THE TOTAL RESULTS 46 #totals should be a ust of length = num_applicants with the totals for each applicant 47 #HINT: you will need a for-loop here 48 totals = 0 49 50 #Task 2: Use try-except to check for an error with a list data type 52 next_applicant contains values that don't make sense to add up 53 maybe as a result of a typing mistake? 54 55 next_applicant - 10,4,2,3,'0',5,1,2,4,4,2,3,'0',4,5,'0',1,2,3,4) 57 Use the module and function from task 1 above to try and sun the values in 58 next applicant and show that an error is returned. 59 HINT: You will need to identify what is wrong with "next_applicant' in the code. 60 We can see that there are the letter 'o' in the list instead of number , 61 but you need to help the program recognize that. 62 63 ATASK 2 CODE HERE 64 65 #Task 3: Use if-else and elif to filter lists 67 results sheet has a total of 100 sumed values in it now, representing the scores 68 on a job entrance exam. You now need to do two things: 69 -Add an index to the list, i.e. the first applicant should be number 1, and so on. 70 -filter all the applicants into categories 71 -the categories are represented as lists: 'make_an_offer', 'waitlist', 'no_offer 72 -the minimum scores for being included in each 72 - make an offer: 60 waittist 51 56 66 DON 79 88 67 results sheet has a total of 100 summed values in it now, representing the scores 68 on a job entrance exam. You now need to do two things: 69 --Add an index to the list, i.e. the first applicant should be number 1, and so on. 70 -filter all the applicants into categories 71 -the categories are represented as lists: 'make_an_offer', 'waitlist', 'no_offer 72 -the minimum scores for being included in each 73 -make_an_offer':68 74 'waitlist': 50 75 -'no offer':

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!