generated from mwc/lab_scatter
sss;dfklj
This commit is contained in:
15
transform.py
15
transform.py
@@ -18,7 +18,7 @@ def minimum(data):
|
||||
"Returns the smallest number in data"
|
||||
lowest = None
|
||||
for number in data:
|
||||
if lowest is none:
|
||||
if lowest is None:
|
||||
lowest = number
|
||||
if number < lowest:
|
||||
lowest = number
|
||||
@@ -28,6 +28,12 @@ def bounds(data):
|
||||
"Returns a list of the smallest and largest numbers in data"
|
||||
highest = maximum(data)
|
||||
lowest = minimum(data)
|
||||
###########################
|
||||
###########################
|
||||
# You are not returning anything here. write a return statement that returns the highest and lowest number
|
||||
###########################
|
||||
###########################
|
||||
return [lowest, highest]
|
||||
|
||||
def clamp(value, low, high):
|
||||
"""Clamps a value to a range from low to high.
|
||||
@@ -55,8 +61,13 @@ def ratio(value, start, end):
|
||||
def scale(value, domain_min, domain_max, range_min, range_max):
|
||||
"Given a value within a domain, returns the scaled equivalent within range."
|
||||
scale = range_min + ((ratio(value, domain_min, domain_max))*(range_max, range_min))
|
||||
|
||||
return scale
|
||||
#return scales
|
||||
###########################
|
||||
###########################
|
||||
# if you return scales (with an s) you are essentiallly returning nothing because you have only defined scale
|
||||
###########################
|
||||
###########################
|
||||
|
||||
def get_x_values(points):
|
||||
"Returns the first value for each point in points."
|
||||
|
||||
Reference in New Issue
Block a user