Jun-26-2019, 05:57 PM
Hey everybody,
newbe here. I'm trying out classes and I don't know how to get the desired results:
Any feedback is welcome and appriciated
newbe here. I'm trying out classes and I don't know how to get the desired results:
class name(): def __init__(self,name): self.name = name self.m = 0 def one(self): if self.name == 'Jack': self.m = self.m + 5 print(self.m) def two(self): if self.m > 0: print(self.m) else: print("no") S = name('Jack') P = name('Tom')I want to start with S.one() and then use P.two() to get 5 but I always get 'no' instead.
Any feedback is welcome and appriciated
