ValueCalculator
Encapsulates stateful computation to avoid global variables.
Attributes
- v: int = 10
- initial_value
Constructors
-
Initializes the ValueCalculator with an optional initial value.
-
Parameters
- initial_value: int
- The starting value for the calculator.
- initial_value: int
Methods
def get_value(x: integer) - > integer
-
Simulate a long-running computation.
-
Parameters
- x: integer
- The integer input for the computation.
- x: integer
-
Return Value: integer
- The computed value after multiplication and state update.