Commits

jhjaggars committed 2ce22be

adding a stair-step table example

Comments (0)

Files changed (1)

code/TableDriven/grades.py

+grade_scale = {
+        90: "A",
+        80: "B",
+        70: "C",
+        60: "D",
+        00: "F"
+        }
+
+def find_max_of_scale( scale, value ):
+    return max(filter( lambda x: value > x, scale.keys() ))
+
+def get_grade( percentage ):
+    return grade_scale[find_max_of_scale(grade_scale, percentage)]