To get started, a filter could ju applicant's grades and accept meet a certain average. 85 is a to start.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 22PE
icon
Related questions
Question
In python
First, your co-worker suggests, "Let's just take students
who have a B average or better in all of their courses."
To get started, a filter could just take the average of an
applicant's grades and accept only those students who
meet a certain average. 85 is a middle B, so let's try that
to start.
Begin the function with the header:
def filter_average (cand):
This function should take as input a single candidate (list
of grades), and return True if the candidate's average
grade across all classes (not just Computer Science) is 85
or higher, or False otherwise. Note that index 6 contains
this value - you don't need to compute an average.
This will help determine whether the candidate should be
interviewed or not.
Test your function to make sure it works for the various
candidates. To do this, you should write test cases using
the candidate lists provided above. Two have been given
to you below - copy these to the bottom of your Python
file and provide at least two more tests, along with
their expected outputs. Determine the expected output
in advance by looking at the list manually, don't just run
the test and write down whatever was output as the
expected output.
_main__':
print(filter_average(candidate9))
#Should output False
print(filter_average (candidate5))
if
_name ==
#Should output True
print(filter_average(candidate2))
#Should output True
Transcribed Image Text:First, your co-worker suggests, "Let's just take students who have a B average or better in all of their courses." To get started, a filter could just take the average of an applicant's grades and accept only those students who meet a certain average. 85 is a middle B, so let's try that to start. Begin the function with the header: def filter_average (cand): This function should take as input a single candidate (list of grades), and return True if the candidate's average grade across all classes (not just Computer Science) is 85 or higher, or False otherwise. Note that index 6 contains this value - you don't need to compute an average. This will help determine whether the candidate should be interviewed or not. Test your function to make sure it works for the various candidates. To do this, you should write test cases using the candidate lists provided above. Two have been given to you below - copy these to the bottom of your Python file and provide at least two more tests, along with their expected outputs. Determine the expected output in advance by looking at the list manually, don't just run the test and write down whatever was output as the expected output. _main__': print(filter_average(candidate9)) #Should output False print(filter_average (candidate5)) if _name == #Should output True print(filter_average(candidate2)) #Should output True
You can use some or all of the following 10 candidate
examples to test your code:
candidate1
90, 82]
candidate2
100, 85]
candidate3
65, 80]
90, 90]
candidate4 =
95, 90]
candidate5 =
95, 94]
candidate6 =
75, 90]
candidate8
candidate7 =
77, 82]
=
candidate9
=
99, 55]
=
candidate10
92, 70]
=
=
=
[95, 93, 50, 91, 98,
[65, 75, 85, 95, 100,
[100, 100, 95, 85, 75,
[98, 70, 55, 61, 98,
[100, 95, 55, 61, 75,
[95, 90, 98, 88, 93,
[90, 80, 80, 100, 70,
[80, 83, 79, 83, 77,
[90, 100, 100, 98, 100,
[77, 82, 92, 100, 95,
Transcribed Image Text:You can use some or all of the following 10 candidate examples to test your code: candidate1 90, 82] candidate2 100, 85] candidate3 65, 80] 90, 90] candidate4 = 95, 90] candidate5 = 95, 94] candidate6 = 75, 90] candidate8 candidate7 = 77, 82] = candidate9 = 99, 55] = candidate10 92, 70] = = = [95, 93, 50, 91, 98, [65, 75, 85, 95, 100, [100, 100, 95, 85, 75, [98, 70, 55, 61, 98, [100, 95, 55, 61, 75, [95, 90, 98, 88, 93, [90, 80, 80, 100, 70, [80, 83, 79, 83, 77, [90, 100, 100, 98, 100, [77, 82, 92, 100, 95,
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Database connectivity
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L