/
Deart_polaris
/
python
Обзор
Документация
Войти
/
Deart_polaris
/
python
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
new_file
24 строки
2 KB
Deart_polaris
create: new_file
22 май 2026, 07:18
Верифицирован
22 май 2026, 07:18
697f090
Код
Авторство
О чём код?
import math class MagicMath: def __init__(self, value): self.value = value def __str__(self): return f"MagicMath with value: {self.value}" def __add__(self, other): if isinstance(other, MagicMath): result = self.value + other.value return MagicMath(result) return NotImplemented def __pow__(self, power, modulo=None): if modulo is None: result = math.pow(self.value, power) else: result = math.pow(self.value, power) % modulo return MagicMath(result) def __abs__(self): return MagicMath(abs(self.value))