✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Write a function rmsFunction(data,t), where data is a list of strings numbers, and t is a threshold. In the function, you should do the following
1) Map the data to floats.
2) Filter to keep only the values that are greater than or equal to the threshold t. The threshold is set to 0 if not provided by the user. If no values pass the filter, return None.
3) Reduce the filtered numbers to compute the root-mean-square (RMS):
Test your code with the following examples:
data = ["3.5", "-2", "0", "4.0", "1.2", "5.3", "-0.7", "2.8"]
#Test 1
t = 2
print(rmsFunction(data,t))
4.0056210504739465
#Test 2
print(rmsFunction(data))
3.307063148273203
#Test 3
t = 10
print(rmsFunction(data,t))
None
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!