I have a class and I want to do something like the following:
class my_class:
def my_func(self, var_name):
self.var_name = 5
a = my_class()
a.my_func('yes')
print(a.yes)
I am not sure how to set the class variable name using the function however
1 Answer