We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 88dd162 commit 80826f2Copy full SHA for 80826f2
1 file changed
PyPortal_Calculator/calculator.py
@@ -99,6 +99,10 @@ def _handle_equal(self):
99
self._set_text(self._accumulator)
100
self._equal_pressed = True
101
102
+ def _update_operand(self):
103
+ if self._operand is not None:
104
+ self._operand = self._get_text()
105
+
106
def add_input(self, input_key):
107
try:
108
if self._error:
@@ -120,8 +124,10 @@ def add_input(self, input_key):
120
124
self._equal_pressed = False
121
125
elif input_key == "+/-":
122
126
self._set_text(calculate(self._get_text(), "*", "-1"))
127
+ self._update_operand()
123
128
elif input_key == "%":
129
self._set_text(calculate(self._get_text(), "/", "100"))
130
131
elif input_key == "=":
132
self._handle_equal()
133
except (ZeroDivisionError, RuntimeError):
0 commit comments