class Rover:
    def __init__(self, x=0, y=0, coins=100):
        if type(coins) is not int or coins < 0:
            raise ValueError("invalid coins")
        self.x = x
        self.y = y
        self._coins = coins

    def move(self, dx, dy):
        self.x += dx
        self.y += dy

    def distance_to(self, other):
        dx = self.x - other.x
        dy = self.y - other.y
        return (dx * dx + dy * dy) ** 0.5

    def spend(self, amount):
        if (type(amount) is not int
                or amount <= 0
                or amount > self._coins):
            return False
        self._coins -= amount
        return True

    def coins_left(self):
        return self._coins

a = Rover(0, 0)
print(a.spend(30), a.coins_left())
print(a.spend(-20), a.coins_left())
