38 lines
851 B
Python
38 lines
851 B
Python
class Expression:
|
|
expression = ""
|
|
# correct_response = 0
|
|
wrong_response = 0
|
|
variables = []
|
|
|
|
def __init__(self, expression_string, variables, wrong_response):
|
|
self.expression = expression_string
|
|
self.variables = variables
|
|
self.wrong_response = wrong_response
|
|
|
|
class Variable:
|
|
name = ""
|
|
type = ""
|
|
starting_point = 0
|
|
ending_point = 0
|
|
|
|
VARIABLE_TYPES = {
|
|
"i" : "Interest",
|
|
"I" : "Interest",
|
|
"n" : "Time",
|
|
"N" : "Time",
|
|
"k" : "Installment",
|
|
"K" : "Installment"
|
|
}
|
|
|
|
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]
|