Python Use Filter Function Calculate Scores Average List Q37181949

PYTHON use filter() function to calculate scores above averagein a list


Answer


def filter(lst): s = 0 for x in lst: s += x avg = s / len(lst) count = 0 for x in lst: if(x > avg): count += 1 return count

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.