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, 22.06.2019 20:00
Need asap write a short paper describing the history and differences between six sigma, waterfall, agile, and scrum models. understanding these models can give you a good idea of how diverse and interesting it development projects can be. describe what the rationale for them is and describe their key features. describe the history behind their development. at least 400 words
Answers: 1
question
Computers and Technology, 22.06.2019 21:30
After you clean an engine with hot water spray, it seems to stall; when it doesn't stall, it's idling noisily. technician a says to check for loose bolts on the flex plate near the torque converter. technician b says to wipe down the spark plug wires and the distributor cap. who is correct? a. technician a b. both technicians a and b c. technician b
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Which of the following would not be considered a pc? a. mainframe b. desktop c. tablet pc d. laptop
Answers: 2
question
Computers and Technology, 24.06.2019 03:00
What is one potential problem associated with an organization purchasing new technology early in its lifecycle
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
English, 10.03.2021 23:50
question
Mathematics, 10.03.2021 23:50
question
Mathematics, 10.03.2021 23:50
question
Mathematics, 10.03.2021 23:50
question
Chemistry, 10.03.2021 23:50
Questions on the website: 13722363