Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

TASK 3 only please 19 14 This script simulates the results of a job entrance exam where applicants 15 complete tests and receive scores. 16

TASK 3 only please
image text in transcribed
image text in transcribed
19 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 random.seed (123) 22 nun applicants - 100 23 nun questions = 20 24 #results from the 20-question exam 25 results sheet = 11 26 for student in range(num_applicants): 27 #generate scores for each student and append to results sheet 28 scores = randon.choices(list(range(0,6)), k=nus_questions) 29 results_sheet.append(scores) 30 #The result here is a list of lasts. 31 32 Sprint out the first row of scores just as an example 33 print (results_sheet[@]) 34 35 #Task 2: 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 36 *** 41 You need to write the code for tile function sum_score) and use it to sum the values in results sheet 42. 51 62 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 = 11 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 = [0,4,2,3,'0',5,1,2,4,4,2,3,'0',4,5,'0',1,2,3,4] 56 * 57 Use the module and function from task 1 above to try and sum the values in S8 "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 in the list instead of number e, 61 but you need to help the program recognize that. 63 STASK 2 CODE HERE 64 65 #Task 3: Use if-else and elif to filter lists 66 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, 1.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 offert:60 74 - waitlist. 50 75 -no_offer:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions