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
Dmitry_Shevchenko [17]
3 years ago
10

Define and use in your program the following functions to make your code more modular: convert_str_to_numeric_list - takes an in

put string, splits it into tokens, and returns the tokens stored in a list only if all tokens were numeric; otherwise, returns an empty list. get_avg - if the input list is not empty and stores only numerical values, returns the average value of the elements; otherwise, returns None. get_min - if the input list is not empty and stores only numerical values, returns the minimum value in the list; otherwise, returns None. get_max - if the input list is not empty and stores only numerical values, returns the maximum value in the list; otherwise, returns None.
Computers and Technology
1 answer:
Lelechka [254]3 years ago
7 0

Answer:

In Python:

def convert_str_to_numeric_list(teststr):

   nums = []

   res = teststr.split()

   for x in res:

       if x.isdecimal():

           nums.append(int(x))

       else:

           nums = []

           break;

   return nums

def get_avg(mylist):

   if not len(mylist) == 0:

       total = 0

       for i in mylist:

           total+=i

       ave = total/len(mylist)

   else:

       ave = "None"

   return ave

def get_min(mylist):

   if not len(mylist) == 0:

       minm = min(mylist)

   else:

       minm = "None"

   return minm

def get_max(mylist):

   if not len(mylist) == 0:

       maxm = max(mylist)

   else:

       maxm = "None"

   return maxm

mystr = input("Enter a string: ")

mylist = convert_str_to_numeric_list(mystr)

print("List: "+str(mylist))

print("Average: "+str(get_avg(mylist)))

print("Minimum: "+str(get_min(mylist)))

print("Maximum: "+str(get_max(mylist)))

Explanation:

<em>See attachment for complete program where I use comment for line by line explanation</em>

Download txt
You might be interested in
The number of worksheets a workbook can contain is limited to the ______ of your computer.
KiRa [710]
<span>The number of worksheets a workbook can contain is limited to the memory of your computer.
The computer memory denotes the </span><span>hardware integrated circuits in the computer. These circuits store information for immediate use in a </span><span>computer, for worksheets for example.</span>
6 0
4 years ago
In Microsoft Word you can access the _______ command from the "Mini toolbar".
xenn [34]
I think the answer is save as
4 0
4 years ago
The set of communications rules for exchanging information electronically on the internet is called the ________.
MA_775_DIABLO [31]
The set of communications rules for exchanging information electronically on the internet is called the URL. URL stands for Uniform Resource Locator. It consists of <span>Protocol identifier that indicates the name of the protocol that is used (for example: http) and  </span>Resource name is the <span>complete address to the resource. brainly.com.</span>
4 0
4 years ago
Describe the steps that transform a program written in a high-level language such as C into a representation that is directly ex
Alla [95]

Answer:

First, you would want to translate from C-language Program (in text format) into the assembly language Program (still in text format, but in the corresponding architecture of the computer where the program will be run). The software tool you will use for this step is Compiler.

Then you would translate from the assembly language program (text format) into Machine Code Program (in binary format). The software tool used for this step would be Assembler.

7 0
2 years ago
A Uniform Resource Locator (URL) consists of three separate parts: network protocol, host, and web browser. True False
harkovskaia [24]

Answer:

False.

Explanation:

A URL (Uniform Resource Locator), usually called a web address is a reference to a web resource that specifies its location on a computer network and a mechanism for retrieving it.

The three basic parts of a URL are the network protocol, the domain name/host and the path.

A URL is used in a web browser, and A web browser is not termed as one of its fundamental parts.

6 0
3 years ago
Other questions:
  • Cameron wants to impress the owner of the company. He creates a graph that shows the improved productivity at the company over t
    13·2 answers
  • If you have cut or copied a set of information, which procedure will NOT work to paste it back into the worksheet?
    14·1 answer
  • Jax needs to write a block of code that will organize a list of items alphabetically. Which function should he use? append() pri
    12·1 answer
  • Develop a Java application that provides program output in a logical manner and incorporates appropriate data types. Similar to
    6·1 answer
  • When you open your word-processing program, it opens in a<br> field<br> menu
    9·2 answers
  • What is artificial Intelligence ?
    11·2 answers
  • Which of the following is a true statement about parameters in data management? Check all that apply.
    11·1 answer
  • The science of how an object reacts to its motion through air is called _______________. (12 letters)
    13·2 answers
  • In a program you need to store identification numbers of 5 employees and their weekly gross pay.
    11·1 answer
  • What are the different types of computer operating systems?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!