not sure if this question has been asked before, maybe the way that I've been wording the question is wrong but here goes,
Suppose I have the code below:
class House:
def __init__(self):
self.living_room = "living_room"
self.bed_room = "bed_room"
self.garage = "garage"
def test(house,room):
print(house.room) #I know I can't write it this way, but just as an example of what I'm hoping to achieve
I want to pass in the property of the House class to the function test for the arguement room such that if room is garage then the test function prints out "garage" and if room is bed_room then "bed_room" gets printed out. Is there a way of achieving this? I prefer not to have multiple functions doing the same thing apart from accessing different properties of the class. Thanks