From de61eded1015739daf84c5756e8e9ed00c09f2c6 Mon Sep 17 00:00:00 2001 From: louiscooper136 Date: Thu, 3 Aug 2023 17:50:56 -0400 Subject: [PATCH] Completed all functions for the turtle graphing exercise. --- transform.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/transform.py b/transform.py index 172d7be..3b91721 100644 --- a/transform.py +++ b/transform.py @@ -34,9 +34,9 @@ def clamp(value, low, high): """ if value >= low and value <= high: return value - elif value > high: + elif value > high: return "High" ,m - else: + else: return "Low" def ratio(value, start, end): @@ -49,12 +49,15 @@ 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." - raise NotImplementedError + #raise NotImplementedError + r = ratio(value, domain_min, domain_max) + return range_min + r * (range_max - range_min) def get_x_values(points): "Returns the first value for each point in points." - raise NotImplementedError + x_vals = points[0] + return x_vals def get_y_values(points): - "Returns the second value for each point in points." - raise NotImplementedError + y_vals = points[1] + return y_vals