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
Which of the following statements best compares and contrasts hot and cold type?
Elina [12.6K]

Answer:

3 text 3

Explanation:

7 0
2 years ago
In your own words, what does Hypertext Markup Language [HTML] do?
nexus9112 [7]

Answer:

HTML dictates how the browser presents images and text on a webpage.

Explanation:

3 0
3 years ago
Read 2 more answers
What can you do to improve your own digital wellness?
julsineya [31]
Update your passwords frequently, delete unused accounts, and be diligent about who and what you give your most personal information to. Invest in tech that fits your lifestyle without offering further distractions.
4 0
3 years ago
Read 2 more answers
A firewall can consist of all devices positioned on the network _____________.
ale4655 [162]

Answer:

The answer to this question is "perimeter".

Explanation:

In computer science, the firewall is used to provide a network security system that manages network traffic like incoming and outgoing signals. This traffics is based on predetermined security rules. The firewall typically installs a boundary between a trusted inner network and an untrusted outer network, such as the Internet. It is a software concept and Perimeter firewalls manage the flow of network traffic and host or organization's border the boundary that provides the first line of security against outer attacks and blocking access to inappropriate content from inside an organization.

6 0
3 years ago
A colleague is complaining about the slowness of a desktop computer, and you explain that the slowness is
mr_godi [17]

Answer:

You are explaining a virtual server

I hope this is correct.

Explanation:

A virtual platform is a software based system that can fully mirror the functionality of the platform, it provides full visibility

A virtual server, on the other hand converts one physical server into multiple virtual machines that can each run their own operating system, it is hosted by a offsite dsta center

6 0
2 years ago
Other questions:
  • How is informatics affecting banking and financial institutions?
    13·1 answer
  • What is the time period of 1st generation of computer ???
    11·1 answer
  • If you get musicilly can your parents see
    14·2 answers
  • .Although SQL is a language, you don’t use it to write applications? (true, false)
    8·1 answer
  • Illia is a network administrator at a company.which tasks is she responsible for
    9·1 answer
  • Blank spaces or unseen control characters in a data file are referred to as
    5·2 answers
  • What computer is designed to meet the computing needs of several people simultaneously in a small to medium-size business enviro
    5·1 answer
  • You want the user to enter the length, width, and height from the keyboard. Which cin statement is correctly written?
    10·1 answer
  • How do you debug an Xcode project?
    10·1 answer
  • You are a developer for a news, entertainment, lifestyle, and fashion website. User traffic has steadily increased month-over-mo
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!