You are missing basic understanding how class works.
So read more about it.
You should not have variables outside the class,
these should be arguments that is given to the class.
Just to write something that make more sense,in the way class work.
Not changing anything to method anything which could be wrong.
So read more about it.
Quote:I dont know what the function anything will returnIt's not called a function when it belong to class,it's now a method.
You should not have variables outside the class,
these should be arguments that is given to the class.
Just to write something that make more sense,in the way class work.
Not changing anything to method anything which could be wrong.
class xyz: def anything(self, anything, somethingelse, a): if something < somethingelse: if a == 10: return something else: return somethingelse elif a > somethingelse: return something else: return something def calculations(self, any_obj): x = any_obj + 5 y = any_obj + 10 return x, y object1 = xyz() something = 10 somethingelse = 0 a = 2 any_obj = object1.anything(something, somethingelse, a) print(object1.calculations(any_obj)) #(15, 20)