USING PYTHON def normalize(list): after u define the function, u need to add thi
ID: 3567156 • Letter: U
Question
USING PYTHON
def normalize(list):
after u define the function, u need to add this test part:
a =[1, -2, 4, 5, 20,33]
print a
print normalizt(a)
Explanation / Answer
#!/usr/bin/env python
def normalize(myList):
minx = min(myList)
maxx = max(myList)
print minx,maxx
for index, element in enumerate(myList):
myList[index] = (( element - minx ) / float(maxx - minx ) )
return myList
# test part
a =[1, -2, 4, 5, 20,33]
print a
print normalize(a)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.