70.0k views
1 vote
write a function called eligible that helps the admission officer of the graduate school of vanderbilt university decide whether the applicant is eligible for admission based on gre scores. the function takes two positive scalars called v and q as input and returns the logical admit as output. they represent the percentiles of the verbal and quantitative portions of the gre respectively. you do not need to check the inputs. the applicant is eligible if the average percentile is at least 92% and both of the individual percentiles are over 88%. the function returns logical true or false value.

User Hhrzc
by
9.2k points

1 Answer

5 votes

Here is a possible implementation of the "eligible" function in Python:

python

Copy code

def eligible(v, q):

avg_percentile = (v + q) / 2

return avg_percentile >= 92 and v > 88 and q > 88

The function takes in two positive scalars, v and q, which represent the percentiles of the verbal and quantitative portions of the GRE, respectively. It calculates the average percentile by taking the sum of v and q and dividing by 2. It then checks if the average percentile is at least 92% and if both v and q are greater than 88%. If these conditions are true, the function returns a logical True value, indicating that the applicant is eligible for admission. Otherwise, it returns a logical False value.

Note that the implementation assumes that the input values are valid positive scalars, as specified in the problem statement. If the input values could potentially be invalid, additional error checking code would be needed to ensure the function does not encounter any errors or unexpected behavior.

User Acid Rider
by
8.4k points