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

Answers

Answer 1
Answer:

Answer:

See explaination

Explanation:

def sum_lengths(value_list):

total = 0

for x in value_list:

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

total += x

return total


Related Questions

Does the following code return a string or a number def of() return 3
Repeat Programming Project 5 but in addition ask the user if he or she is a. Sedentary b. Somewhat active (exercise occasionally) c. Active (exercise 3–4 days per week) d. Highly active (exercise every day) If the user answers "Sedentary," then increase the calculated BMR by 20 percent. If the user answers "Somewhat active," then increase the calculated BMR by 30 percent. If the user answers "Active," then increase the calculated BMR by 40 percent. Finally, if the user answers "Highly active," then increase the calculated BMR by 50 percent. Output the number of chocolate bars based on the new BMR value.
Why are two-way communications necessary between the front desk and housekeeping?
What is the correct meaning of judgment
The program that you create for this exercise will begin by reading the cost of a meal ordered at a restaurant from the user. Then your program will compute the tax and tip for the meal. Use your local tax rate when computing the amount of tax owing. Compute the tip as 18 percent of the meal amount (without the tax). The output from your program should include the tax amount, the tip amount, and the grand total for the meal including both the tax and the tip. Format the output so that all of the values are displayed using two decimal places.

Which of the following statements describes a limitation of using a computer simulation to model a real-world object or system?a. Computer simulations can only be built after the real-world object or system has been created.
b. Computer simulations only run on very powerful computers that are not available to the general public.
c. Computer simulations usually make some simplifying assumptions about the real-world object or system being modeled.

Answers

Answer:

The answer is "Option c".

Explanation:

Computer simulation, use of a machine to simulate a system's vibration signals by another modeled system's behaviors. A simulator employs a computer program to generate a mathematical model or representation of a true system. It usually gives a lot of simplifications concerning the physical image or system that is modeled, so this statement describes the limitation of using a computer simulation in modeling a real-world object or process.

The sql standard prescribes three different types of __________ operations: left, right, and full.

Answers

The sql standard prescribes three different types of JOIN operations: left, right, and full.
 
The LEFT [OUTER] JOIN yields all rows with matching values in the join columns, plus all ofthe unmatched rows from thelefttable.
The RIGHT [OUTER] JOIN yields all rows with matching values in the join columns, plus all ofthe unmatched rows from therighttable.
 The FULL [OUTER] JOIN yields all rows with matching values in the join columns, plus all theunmatched rows from both tables named in the FROM clause.

What is a digital projector? How is it different from computer screen?

Answers

Answer:

An LCD projector is a type of video projector for displaying video, images, or computer data on a screen or other flat surface. It is a modern equivalent of the slide projector or overhead projector.

It's different because in a computer display, the screen is the physical surface on which visual information is presented. This surface is usually made of glass.

Explanation:

A digital projector is a device that projects video or images onto a large screen, suitable for shared viewing in larger settings. It differs from a computer screen in terms of size, portability, shared viewing capabilities, image quality, source connectivity, and adjustments.

A digital projector is a device that takes a video or image signal from a computer, DVD player, or other multimedia source and projects it onto a large screen or surface.

The key differences between a digital projector and a computer screen:

Size: The most obvious difference is the size of the display.

Portability: Computer screens are generally fixed and not easily portable, whereas digital projectors are often designed for mobility.

Shared Viewing: A computer screen is designed for individual or small group viewing at close distances, while a digital projector is meant for larger audiences.

Image Quality: Digital projectors vary in imagequality, and high-quality projectors can offer impressive resolution and brightness suitable for movie screenings or professional presentations.

Source Connectivity: Both a computer screen and a digital projector can receive input from computers and other multimedia sources.

Placement and Adjustment: Digital projectors often provide manual or automatic keystone correction and focus adjustments to ensure the projected image remains proportional and clear on the screen or surface.

Hence,  a digital projector is a device used to project large-scale images or video onto a screen or surface, suitable for shared viewing in larger settings.

To learn more on Digital projector click here:

brainly.com/question/19486217

#SPJ3

____ means saving data in computer memory.

Answers

Answer: Storage

Explanation:

Storage means means saving data in computer memory. Memory refers to the location which is meant for short-term data, while storage is the part of the computer system that allows an individual to store and also access data on long-term basis.

It should be noted that typically, storage usually comes in form of a hard drive or a solid-state drive.

A computer professional who has access to sensitive information shares this information with a third party. Which professional code of conduct did the person violate? A. diligence in service B. company discipline norms C. confidentiality of information D. conflict of interest

Answers

Answer:

Confidentiality of Information

Explanation:

Because when you work for a company that confidential information, the company usually asks it employees not to discuss or share information with anyone. The company usually asks their employees to sign a Confidentiality Contract.

Which of these terms best describes the type of AI used in today’s email spam filters, speech recognition, and other specific applications?A. Artificial Narrow Intelligence (ANI)
B. Artificial General Intelligence (AGI)

Answers

The term that is described in the question is A. Artificial Narrow Intelligence.

Artificial intelligence simply means the ability of a computer system to automatically make decisions based on the input value received.

Artificial Narrow Intelligence is the computer's ability to do a single task well. It's used in today’s email spam filters, speech recognition, and other specific applications.

Read related link on:

brainly.com/question/16439202

Answer:

A. Artificial Narrow Intelligence.

Explanation:

Artificial intelligence is the ability of a computer system, with the help of programming, automatically make decisions as humanly as possible, based on the input value received. There are three types of artificial intelligence, namely, artificial narrow intelligence (ANI), artificial general intelligence (AGI) and artificial super intelligence (ASI).

ANI is focus on executing one specific task extremely well like web crawler, speech recognition, email spam filters etc. AGI is meant to handle human intellectual task, while ASI performs task beyond human intellect.

Other Questions