-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathVariable.py
More file actions
26 lines (20 loc) · 720 Bytes
/
Variable.py
File metadata and controls
26 lines (20 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class Variable():
def __init__(self, var_name, truthValue):
self.var_name = var_name
self.truthValue = truthValue
def printVar(self):
print("~{},".format(self.var_name))
def stringVar(self):
if self.truthValue:
return "{}".format(self.var_name)
return "~{}".format(self.var_name)
def getVariable(self):
return self.var_name
def getTruthValue(self):
return self.truthValue
def negateVariable(self):
self.truthValue = not self.truthValue
def __eq__(self, other):
if self.var_name == other.var_name and self.truthValue == other.truthValue:
return True
return False