In: Computer Science
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.
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
===============================================================