/
IvanKhabarov
/
python
Обзор
Документация
Войти
/
IvanKhabarov
/
python
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
Lections/Lesson11/task5.py
15 строк
367 B
Ivan-Khabarov
Добавлен урок 11
29 сен 2024, 13:44
29 сен 2024, 13:44
833c32c
Код
Авторство
О чём код?
class MyClass: def __init__(self, a, b): self.a = a self.b = b self.c = a + b def __str__(self): return f'MyClass(a={self.a}, b={self.b}, c={self.c})' def __eq__(self, other): return (sum((self.a, self.b)) - self.c) == (sum((other.a,other.b)) - other.c) x = MyClass(42, 2) y = MyClass(73, 3) print(x == y)