Question: Task two please. Logout File Ede View Language Python 10 -LOOPS 12 13 14 This script sinulates the results of a job entrance exam where

Logout File Ede View Language Python 10 -LOOPS 12 13 14 This script sinulates 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. 19 28 import random 21 random seed (123) 22 nun applicants - 100 23 nunquestions = 20 24 results from the 20-question exam 25 results_sheet = 0 26 for student in range(num_applicants): 27 #generate scores for each student and append to results sheet 28 scores = randon.choices(listtrangel0,6)), en questions) 29 results sheet.append(scores) 30 The result here is a list of lists. 31 32 #print out the first row of scores just as an example 33 print results sheet[0]) 1 34 35 Task 1: write a method in an external module and Import it into this script 36 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 nane 40 41 You need to write the code for the function sun score() and use it to sun the values in results sheet 42 43. IMPORT CODE HERE 44 45 #CODE TO SUN AND REPORT THE TOTAL RESULTS 16 totals should be a list of length = num_applicants with the totals for each applicant 47 RHINT: you will need a for-loop here 48 totals D 49 50 Task 2: Use try-except to check for an error with a list data type 51 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,41 56 SZ Use the module and function from task 1 above to try and sun the values in 55 "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. 6 We can see that there are the letter 'O' in the list instead of number 0 61 but you need to help the program recognize that. 63 TASK 2 CODE HERE *** 11 File Edit View Language 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('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 17 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
