r801_cambiar_representacion.py
class Par:
def __init__(self, x:int, y:int):
self.x = x
self.y = y
def __repr__(self):
return 'Par({0.x!r}, {0.y!r})'.format(self)
def __str__(self):
return '({0.x!s}, {0.y!s})'.format(self)
par = Par(2, 3)
par
print(par)
Comments
0 B
|👍
/👎