Question

In: Computer Science

Find the statistics for a single quantitative variable by utilizing Encapsulation and Namespace functions: Each function...

Find the statistics for a single quantitative variable by utilizing Encapsulation and Namespace functions:

Each function should accept a list as an input parameter:

List = [1,2,3,4,5,6]

Functions : lst_min, lst_max, lst_range, lst_variance, lst_stdev.

Use: Python programming language, please. (Note: without inbuilt function)

Thank you.

Solutions

Expert Solution

Thanks for the question. Below is the code you will be needing. Let me know if you have any doubts or if you need anything to change. 

Let me know for any help with any other questions.

Thank You!


===========================================================================

def lst_min(lst):
    if len(lst)==1: return lst[0]
    min = lst[0]
    for num in lst:
        if num<min:
            min = num
    return min

def lst_max(lst):
    if len(lst)==1: return lst[0]
    max = lst[0]
    for num in lst:
        if num>max:
            max = num
    return max

def lst_range(lst):
    return lst_max(lst)-lst_min(lst)

def lst_variance(lst):
    total,count = 0,len(lst)
    for num in lst:
        total+=num
    mean = total/count
    variance = 0
    for num in lst:
        variance += (num-mean)**2
    return variance/count

def lst_stdev(lst):
    return lst_variance(lst)**0.5

===============================================================


Related Solutions

Classify each variable as qualitative or quantitative.
Classify each variable as qualitative or quantitative.(a) Number of bicycles sold in 1 year by a large sporting goods store.(b) Colors of baseball caps in a store.(c) Times it takes to cut a lawn.(d) Capacity in cubic feet of six truck beds.(e) Classification of children in a day care center (infant, toddler, preschool).(f) Weights of fish caught in Lake George.(g) Marital status of faculty members in a large university.
write C++ program using functions (separate function for each bottom) Write a program to find if...
write C++ program using functions (separate function for each bottom) Write a program to find if a number is large word for two given bottom base - bottom1 and bottom2. You can predict that a number, when converted to any given base shall not exceed 10 digits. . the program should ask from user to enter a number that it should ask to enter the base ranging from 2 to 16 after that it should check if the number is...
Label the type of each variable listed in the dataset as either quantitative or categorical, and...
Label the type of each variable listed in the dataset as either quantitative or categorical, and denote its scale of measurement (ratio, interval, ordinal, nominal). Wage (average hourly earnings) Education (years of education) Experience (years of experience) Tenure (length of time employed) Race Gender Married Dependents
Are the following functions satisfiable? If the function is satisfiable, with a single line containing 4...
Are the following functions satisfiable? If the function is satisfiable, with a single line containing 4 comma-separated values, each of which is either True or False, for x, y, z, v in this order. For example, you would submit: True,False,True,False. If the function is not satisfiable, use the laws of propositional logic to prove that the function is a contradiction. a) xy ̄+zv b) (x+y)(x ̄+z)(y ̄+z ̄)(x+v) c) xx ̄+yy ̄+zz ̄+vv ̄ d) (x+y)(x+y+z)+not(x+y+z)not(x+y+z+v)
: FINDING DOMAINS AND RANGES OF FUNCTIONS. For each of the following functions, find its domain...
: FINDING DOMAINS AND RANGES OF FUNCTIONS. For each of the following functions, find its domain and range. fx=25 gx=15+3x hx=7x+8 ix=11-8x-2x2
Determine if each variable included in the data set is quantitative (continuous, numerical) or qualitative (categorical)...
Determine if each variable included in the data set is quantitative (continuous, numerical) or qualitative (categorical) and then give its level of measurement: Gender Age Marital Status Highest education level Weight Height Rate general health Rate physical fitness Rate current weight Do you smoke How many cigarettes per day How many alcoholic drinks per day How many caffeine drinks per day Hours sleep week nights Hours sleep weekends How many hours sleep needed Trouble falling asleep? Trouble staying asleep Wake...
classify each variable as quantitative or categorical. for categorical- state whether its ordinal or nominal for...
classify each variable as quantitative or categorical. for categorical- state whether its ordinal or nominal for quantitative- state whether its continuous or discrete and whether the level of measurement is ratio or interval VARIABLES: Marital Status Happiness Cholestoral Change Blood Pressure Change Vision Change Age Male
Implement each of the following functions and write a basic main() function that tests each. For...
Implement each of the following functions and write a basic main() function that tests each. For convenience, you should be able to find this starter class under Mimir's assignment 4 starter code. Do not change the name, parameters, or returns of any of these functions or of the name of the class itself. There is also no need in this assignment for any global variables. You are strongly encouraged to use your solution for some of these functions in others...
Define and defend all variables, including the dependent variable, in a single paragraph for each variable....
Define and defend all variables, including the dependent variable, in a single paragraph for each variable. Also, state the expectations for each independent variable. These paragraphs should be in numerical order, i.e., dependent variable, X1, then X2, etc. Dependent Variable: Players Annual Pay Independent Variables: Batting average, Stolen bases, Home Runs, and RBIs. In each paragraph, the following should be addressed: How is the variable defined in the data source? Which unit of measurement is used? For the independent variables:...
Write the following functions. Each function needs function comments that describes function and its parameters double...
Write the following functions. Each function needs function comments that describes function and its parameters double sphereVolume( double radius) double sphereSuface( double radius) double cylinderVolume( double radius, double height) double coneSurface( double radius, double height) double coneVolume( double radius, double height) That computes the volume and surface of the sphere with radius, a cylinder with a circular base with radius radius , and height height , and a cone with a circular base with radius radius , and height height...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT