1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
gulaghasi [49]
3 years ago
5

If you have a list consisting of just numbers, then you can add all of the values in the list using the sum() function. If your

list consists of some numbers and some values of other types (e.g., lists, strings, sets), the sum() function will fail. In this question, we're asking you to write a function that will sum all of the numbers in a list, ignoring the non-numbers. The function below takes one parameter: a list of values (value_list) of various types. The recommended approach for this: (1) create a variable to hold the current sum and initialize it to zero, (2) use a for loop to process each element of the list, (3) test each element to see if it is an integer or a float, and, if so, add its value to the current sum, (4) return the sum at the end.
Computers and Technology
1 answer:
Arte-miy333 [17]3 years ago
8 0

Answer:

def sum_numbers(value_list):

   total = 0

   for n in value_list:

       if type(n) == int or type(n) == float:

           total += n

   return total

Explanation:

Create a function called sum_numbers that takes one parameter, value_list

Initialize the total as 0

Create a for loop that iterates through the value_list

Inside the loop, check the type of the elements. If they are either int or float, add them to total.

When the loop is done, return the total

You might be interested in
A(n) ________ software installation copies all the most commonly used files to your computer's hard drive.
irinina [24]

Answer:

Full

Explanation:

According to my research on IT tasks, I can say that based on the information provided within the question this type of software installation is called a Full Software Installation. This type of installation is usually done when installing a brand new operating system, which you then need to install all the necessary software that is commonly needed.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

8 0
3 years ago
You want to purchase a new hard drive for your workstation and are deciding between an HDD and an SDD. Which of the following is
Ipatiy [6.2K]
HDDs usually wear down faster and give less performance quality than SSD but HDDs are still cheaper. If your aiming for budget , HDD is the right one for you.
3 0
3 years ago
Which part of a window lets you see a fileâs contents without opening the file?
Artyom0805 [142]
The preview pane. On the right hand side of the file explorer.
3 0
3 years ago
Why is it better for a CPU to have more than one cache?
Kitty [74]

Explanation:

i think cpu needs to have backup chache units in case of electrical failure

5 0
2 years ago
Read 2 more answers
Assume that grade is a variable whose value is a letter grade-- any one of the following letters: 'A', 'B', 'C', 'D', 'E', 'F',
d1i1m1o1n [39]

Answer:

switch (grade) {

 case 'A':

   acount++;

   break;

 case 'B':

   bcount++;

   break;

 case 'C':

   ccount++;

   break;

 case 'D':

   dcount++;

   break;

 case 'E':

   ecount++;

   break;

 case 'F':

   fcount++;

   break;

 case 'W':

   wcount++;

   break;

 case 'I':

   icount++;

   break;

}

Explanation:

6 0
3 years ago
Other questions:
  • Which of the following is needed if a computer with the IP address 172.31.210.10/24 wants to communicate with a computer with th
    5·1 answer
  • Which does an icon on the desktop signify?
    12·1 answer
  • If you want to copy text formatting from one area of your document to another area, _____.
    5·2 answers
  • __________%of the users have left websites in frustration due to poor navigation.
    13·1 answer
  • Edie wants to visit her university's website. What software application should she use?
    9·2 answers
  • What constructs break or bend the normal Syntax patterns of scheme?
    15·1 answer
  • True or false, USBs are slower than RAM.
    15·1 answer
  • STOP DELETING MY ANSWERS AND QUESTIONS!!!!!!!
    9·1 answer
  • Multiple Select Which of these are ways a hacker might learn someone's password? Select 3 options. o social engineering keylogge
    12·1 answer
  • If a password is entered wrongly three times the computer will
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!