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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education