Question
NAME OF THE CVS my_moduleprint #my module script to be inlcuded in main program #e x a m p l e function to be imported
NAME OF THE CVS "my_moduleprint"
#my module script to be inlcuded in main program
#e x a m p l e function to be imported def print_name(first, last = None): if last: print(f'Hello, {first} {last}!') else: print(f'Hello, {first}!')
def sum_score(list): ''' For a provided numeric list, sum the values and return the result. ''' #HINT: look up the documentation for a 'function return' #INSERT YOUR CODE HERE
Here is the question:
This script simulates the results of a job entrance test 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 e x a m 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 e x a m ple print(results_sheet[0])
#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 = []
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