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
LIST THE SKILLSET NEEDED FOR BECOMING A PROGRAMMER.
wolverine [178]

Answer:

Proficiency with programming languages.  

Learning concepts and applying them to other problems.  

Mathematical skills.  

Problem-solving capability.  

Communication skills.

Writing skills.  

Inquisitiveness.  

Self-motivation.

7 0
2 years ago
Name the technique used to separate the mixture of colours in black ink ​
Nitella [24]

Answer:

chromatography

hope it helps

6 0
2 years ago
Read 2 more answers
Help 25 points!!!!!!!
Len [333]

Answer:

can u say what the word bank is plz?

Explanation:

3 0
3 years ago
Read 2 more answers
The library Wi-Fi kiosk requires a symmetric connection to the Internet. Which WAN technology would probably be the least expens
kenny6666 [7]

Answer:

The answer is IP-sec.

Explanation:

0.75 miles of range is a low distance for a WAN (Wide Area Network) so a point-to-point WAN tehcnology such as IP-sec or SD-WAN can be preferred. But the least expensive option would be choosing IP-sec as specified in the question.

I hope this answer helps.

6 0
3 years ago
Java write code that inserts useritems into the output string stream itemsoss until the user enters "exit". each item should be
Step2247 [10]
If you're a zybooks user.

itemsOSS.print(userItem + " "); 
      userItem = itemCharStream.toString();
4 0
3 years ago
Read 2 more answers
Other questions:
  • What do we call a subset of new media in which groups and their fans can interact directly?
    14·1 answer
  • You put $500 in an interest bearing bank account that pays 2% per year but has a fee of $2 per month. Are you getting ahead?
    14·2 answers
  • The top of a ladder must extend how many feet above the surface a worker is climbing onto?
    7·1 answer
  • 8.5 question 2 edhesive
    11·1 answer
  • Circular errors are caused by adding the cell name of a/an _______ cell to a formula.
    11·2 answers
  • To implement a small database, a database designer must know the "1" and the "M" sides of each relationship and whether the rela
    7·1 answer
  • I need help please !!!!
    12·1 answer
  • चार फरक छुट्याउनुहोस् ।) 3. Write down any four provisions of cyber ethic साइबर नैतिकताका कुनै चार प्रावधानहरु लेख्नुहोस् ।​
    11·1 answer
  • A binary search algorithm ____________ an ordered list in<br> half to find an item.
    13·1 answer
  • Draw a flowchart that solve the problem of calculating the average of 5 numbers.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!