class TendonWalk: def __init__(self): self.place = 0 self.distance = 0 def ten(self): self.place += 2 self.distance += 2 def don(self): self.place -= 1 self.distance +=1 def derive(self, x): while True: if x == self.place: return self.distance self.ten() if x == self.place: return self.distance self.ten() if x == self.place: return self.distance self.don() if x == self.place: return self.distance self.don() if x == self.place: return self.distance self.ten() if x == self.place: return self.distance self.don() if x == self.place: return self.distance self.don() if x == self.place: return self.distance tendon_walk = TendonWalk() tendon_walk.derive(X)