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
simpley convert the code below to assembly languageYour proof-of-study task is to hand-compile the code below into an assembly l
sweet-ann [11.9K]
I idk :) ok study is (((47437)
8 0
3 years ago
In batch operating system three job J1 J2 and J3 are submitted for execution each job involes an I/O activity a CPU time and ano
salantis [7]

Answer:

(A) The CPU time for J1 is =2 ms other time is =18 ms, for J2 CPU time =6 ms other time = 24 ms, for J3 CPU time = 3 ms and other time = 12 ms (B) The CPU Utilization for uni-programming is 0.203 or 20.3% (C) For Multi-programming, when a program is not free and busy with an operation, the CPU is allocated to other programs.

Explanation:

Solution

Given that:

A(1)Job J1 = CPU time = 2ms  

Other time =18 ms

Total time = 20 ms

(2)Job J2 = CPU time 6ms

Other time = 24 ms

Total time = 30 ms

(3)Job J3 = CPU time = 3ms

Other time =12ms

Total time = 15 ms

(B) For the CPU Utilization for uni-programming, we have the following as follows:

CPU utilization =The total time of CPU/The total real time

Thus,

=(2 +6+3) / (18+24+12)

= 11/54

=0.203 or 20.3%

(C) For the CPU utilization for multi-programming,  when a program is not available that is busy in an operation, such as the input and output the CPU can be allocated or designated to other programs

5 0
3 years ago
4. UPS stands for Uninterrupted Power Supply . (Yes /no
ser-zykov [4K]

Answer:

4)true

5)no(not good for computer )

6)easy

4 0
3 years ago
By applying styles, _______ formats are being applied each time. A. various B. different C. the same D. similar
Dmitry [639]
I just took the test on (PF) it's C. the same

i hope this helped someone.
;-)
4 0
4 years ago
Read 2 more answers
Al E
zzz [600]

Answer:

A. Fit test

Explanation:

i did this before, hope i helped

5 0
3 years ago
Other questions:
  • Suppose an array with six rows and eight columns is stored in row major order starting at address 20 (base 10). If each entry in
    8·1 answer
  • A computer system has 9,850 processes and 172 of them were suspended while 276 of them were terminated. Explain why some of the
    12·1 answer
  • For each recursive call, display the outputs on a separate line and add a level of indentation. do your utmost to make the outpu
    10·1 answer
  • In which circumstances would the view side by side feature be useful or helpful.
    15·2 answers
  • The company’s computer network is down. Who should you contact to correct this problem? Information Technology Associate Master
    12·1 answer
  • Plz help
    8·1 answer
  • Join my me et.goo gle.etj-dovn-kds​
    11·1 answer
  • What types of character Microsoft Excel understand​
    6·1 answer
  • In order to multitask, a computer must have two or more processors. True or False
    5·2 answers
  • A single access point, and the set of hosts it serves, is called a(n) ________. BSS BSSID ESS None of these
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!