id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

konstans@stuy.edu > processScoresWithAbsent
prev  |  next  |  chance

Now process a list with integer test scores that may be "A" for absent. Drop the lowest and highest grades. If there is at least one "A" present, drop that instead of the lowest grade. If there are two "A" present, drop one instead of the lowest grade and also remove the other before dropping the highest and calculating the average.
Finally return the list (because codingbat checks returned values)
Note: Python 2 has different division rules. Please divide by a floating point to get decimal results e.g. divide by: (1.0*NUMBER_YOU_WANT_TO_DIVIDE_BY)


processScoresWithAbsent([71, 81, 'A']) → [71, 71.0]
processScoresWithAbsent([84, 'A', 98, 82]) → [84, 82, 83.0]
processScoresWithAbsent([84, 'A', 'A', 82]) → [82, 82.0]

...Save, Compile, Run (ctrl-enter)

def processScoresWithAbsent(data):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Copyright Nick Parlante 2017 - privacy