Question

PYTHON These are the scores scores = [25, 56, 79, 94, 99] I've already found the...

PYTHON

These are the scores

scores = [25, 56, 79, 94, 99]

I've already found the average

average = total_scores/len(scores)
print("Sum of all scores: " + str(total_scores))
print("Average: " + str(average))

How do I make exceptions for those above the average

# use filter() to figure scores that are above average please help me write a code for inside the paranthesis

above_avg = filter()

0 0
Add a comment Improve this question Transcribed image text
Answer #1
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

scores = [25, 56, 79, 94, 99]

above_avg = filter(scores)

Add a comment
Know the answer?
Add Answer to:
PYTHON These are the scores scores = [25, 56, 79, 94, 99] I've already found the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Python please help! Thanks you Write a code to get an unlimited number of grades from...

    Python please help! Thanks you Write a code to get an unlimited number of grades from the user (the user can press enter to finish the grades input, or use a sentinel, for example-1), and then calculate the GPA of all the grades and displays the GPA To do this you might need some help. Try to follow the following process (and check your progress by printing different values to make sure they are as they supposed to be): 1-...

  • I'm making a To-Do list in Python 2 and had the program running before remembering that...

    I'm making a To-Do list in Python 2 and had the program running before remembering that my professor wants me to put everything in procedures. I can't seem to get it to work the way I have it now and I can't figure it out. I commented out the lines that was originally in the working program and added procedures to the top. I've attached a screenshot of the error & pasted the code below. 1 todo_list = [] 2...

  • what should line 155 and 156 say? 117 print (AverageAdulLupului 118 19 #Though wait... If you...

    what should line 155 and 156 say? 117 print (AverageAdulLupului 118 19 #Though wait... If you look at AdultTotal and Number of Species, the calculation 20 #should be 114/9....That's not 12! It's 12 and two thirds! (or 12.66666666... 121 #The problem is that python automatically interprets whole numbers as integers 122 #Try and see the difference between the below examples 123 print( 3/5) 124 print(3.0/5) 125 #If you put a decimal in the number, python knows that the numbers aren't...

  • NOTE: USE PYTHON CS160 Computer Science Lab 14 Working with lists, functions, and files Objective: Work...

    NOTE: USE PYTHON CS160 Computer Science Lab 14 Working with lists, functions, and files Objective: Work with lists Work with lists in functions Work with files Assignment: Part 1: Write a program to create a text file which contains a sequence of test scores. Ask for scores until the user enters an empty value. This will require you to have the scores until the user enters -1. After the scores have been entered, ask the user to enter a file...

  • Python 3 Question Do NOT use global variables (This is an edit to a question I've...

    Python 3 Question Do NOT use global variables (This is an edit to a question I've asked before because I forgot to include a template. So if you have answered this question already I ask that you do not copy and paste a previous answer.) PLEASE use the template given, keep the code introductory friendly, and include comments. Many thanks. Prompt: The results of a survey of the households in your township are available for public scrutiny. Each record contains...

  • I need help writing python code with following instructions. You will write a program that reads...

    I need help writing python code with following instructions. You will write a program that reads a data file. The data file contains ticket IDs and ticket prices. Your job is to read these tickets (and prices). find minimum, maximum and average ticket prices and output a report file. The report file should look exactly (or better than) the one attached (output.txt). Input: A31 149.99 B31 49.99 A41 179.99 F31 169.99 A35 179.99 A44 169.99 open "input.txt" file using open()...

  • I have a python project that requires me to make a password saver. The major part...

    I have a python project that requires me to make a password saver. The major part of the code is already giving. I am having trouble executing option 2 and 3. Some guidance will be appreciated. Below is the code giving to me. import csv import sys #The password list - We start with it populated for testing purposes passwords = [["yahoo","XqffoZeo"],["google","CoIushujSetu"]] #The password file name to store the passwords to passwordFileName = "samplePasswordFile" #The encryption key for the caesar...

  • Could anyone help add to my python code? I now need to calculate the mean and...

    Could anyone help add to my python code? I now need to calculate the mean and median. In this programming assignment you are to extend the program you wrote for Number Stats to determine the median and mode of the numbers read from the file. You are to create a program called numstat2.py that reads a series of integer numbers from a file and determines and displays the following: The name of the file. The sum of the numbers. The...

  • Please read this comment: This is the only file given by my professor and so can...

    Please read this comment: This is the only file given by my professor and so can you please help me to write a python program. You can use any test file and post the output with the code. The output might be different then above but please help me to get started with the PYTHON code. Thank you in advance You are going to write a Python program that represents a command line version of a hexadecimal editor. This program...

  • Declare and initialize 4 Constants for the course category weights: The weight of Homework will be...

    Declare and initialize 4 Constants for the course category weights: The weight of Homework will be 15% The weight of Tests will be 35% The weight of the Mid term will be 20% The weight of the Fin al will be 30% Remember to name your Constants according to Java standards. Declare a variable to store the input for the number of homework scores and use a Scanner method to read the value from the Console. Declare two variables: one...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT