subject

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.

student. py 1

Hef sum_lengths(value_list):

# Implement your function here. Be sure to indent your code block! Restore original file

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 16:00
Ramon is graphing the function  f(x) = 3(4)x. he begins by plotting the initial value. which graph represents his initial step?
Answers: 2
question
Computers and Technology, 22.06.2019 16:30
What type of file does a cookie place on web site visitors' computers so that web site managers can customize their sites to their visitors' preferences?
Answers: 1
question
Computers and Technology, 23.06.2019 16:10
What is the ooh? a. omaha occupation handbook b. online occupational c. occupations online d. occupational outlook handbook select the best answer from the choices provided
Answers: 3
question
Computers and Technology, 24.06.2019 12:30
Nikki sent flyers in the mail to all houses within the city limits promoting her computer repair service what type of promotion is this and example of
Answers: 1
You know the right answer?
If you have a list consisting of just numbers, then you can add all of the values in the list using...
Questions
question
Social Studies, 27.08.2019 23:30
question
Mathematics, 27.08.2019 23:30
question
Health, 27.08.2019 23:30