I want to create a function within a class that can access two different members with the same function. For example in the code below, I want both of the lines below to use the 'apply' function on different variables in the class
print(state.apply(rate))
print(state.apply(wage))
I had thought if I put in a dummy variable in the function definition (called exposure), it would replace it with the variables passed to the function (rate and wage in the example below). What is the correct way of doing this in python 3?
class State():
def __init__(self):
    self.rate = 0
    self.wage = 0
def apply(self, exposure):
    self.exposure = self.exposure - 1
    return self.exposure
state = State()
rate = State.rate
wage = State.wage
print(state.apply(rate))
print(state.apply(wage))
EDIT: I had made a typo where I had State instead of state in each print statement. I have now corrected this
State, and its instances, of which you can make as many as you wish but in the above example make only one, namedstate. TheStateclass has noratenorwage(instances have those attributes because their__init__sets them) andapplycan be called on an instance, not on the whole class (and requires theexposureattribute to be there in advance). So, your Q needs much more clarity.