When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This adjustment can be done by normalizing to values between 0 and 1, or throwing away outliers.
For this program, read in a list of floats and adjust their values by dividing all values by the largest value. Output each value with two digits after the decimal point. Follow each number output by a space.
Ex: If the input is:
30.0 50.0 10.0 100.0 65.0
the output is:
0.30 0.50 0.10 1.00 0.65
python please: also input is a list of numbers not individual inputs for the assignment, also there are multiple input sets aside from the ones given, how can i fix this code to applyto multiple sets of lists?
def normalize(dataset): largestValue=max(dataset) normalDataSet=[] for i in range(len(dataset)): n=dataset[i]/largestValue normalDataSet.append(n) return normalDataSet
dataset=[]normal=normalize(dataset)for i in range(len(normal)): print('%.2f'%normal[i],end=" ")
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here