Загрузка данных


class CelestialBody:
    def __init__(s, m, r, star=''):
        s.m = m
        s.r = r
        s.star = star

    def acceleration(s, r):
        return round(s.m / (s.r + r) ** 2, 5)

    def __repr__(s):
        n = type(s).__name__
        return f"{n}(mass={s.m}, radius={s.r}, star='{s.star}')"


class Planet(CelestialBody):
    def __init__(s, m, r, d, star=''):
        super().__init__(m, r, star=star)
        s.d = d

    def __isub__(s, n):
        s.m -= n
        return s

    def __eq__(s, o):
        return (s.m, s.r, s.d, s.star) == (o.m, o.r, o.d, o.star)

    def __lt__(s, o):
        return (s.m, s.r, s.d, s.star) < (o.m, o.r, o.d, o.star)

    def __le__(s, o):
        return (s.m, s.r, s.d, s.star) <= (o.m, o.r, o.d, o.star)

    def __gt__(s, o):
        return (s.m, s.r, s.d, s.star) > (o.m, o.r, o.d, o.star)

    def __ge__(s, o):
        return (s.m, s.r, s.d, s.star) >= (o.m, o.r, o.d, o.star)


class Megastructure(Planet):
    def __init__(s, m, r, d, t, star='', mode='sphere'):
        super().__init__(m, r, d, star=star)
        s.t = t
        s.mode = mode

    def __mul__(s, p):
        return Megastructure(
            s.m + p.m, s.r, s.d,
            s.t + int(p.m // 100),
            star=s.star, mode=s.mode
        )

    def __call__(s):
        return (
            f"The megastructure of a star {s.star} "
            f"has the following parameters:\n"
            f"mass {s.m},\n"
            f"radius {s.r},\n"
            f"distance {s.d},\n"
            f"structure type {s.mode},\n"
            f"thickness {s.t}."
        )