Changed the JSON generator to generate JSON that includes the correct answer for the expression.

This commit is contained in:
2020-04-13 00:05:17 -05:00
parent 1265f8ac3e
commit d1231b062f
6 changed files with 43 additions and 20 deletions
+27
View File
@@ -0,0 +1,27 @@
class Expression:
expression = ""
variables = []
def __init__(self, expression_string, variables):
self.expression = expression_string
self.variables = variables
class Variable:
VARIABLE_TYPES = {
"i" : "Interest",
"I" : "Interest",
"n" : "Time",
"N" : "Time"
}
def __init__(self, name, type, starting_point = 0, ending_point = 0):
self.name = name
self.type = type
self.starting_point = starting_point
self.ending_point = ending_point
@staticmethod
def get_variable_type(variable_name):
if not variable_name in Variable.VARIABLE_TYPES:
return "Unknown"
return Variable.VARIABLE_TYPES[variable_name]