Advertisement
Fhernd

r801_cambiar_representacion.py

Dec 2nd, 2018
2,094
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. class Par:
  2.     def __init__(self, x:int, y:int):
  3.         self.x = x
  4.         self.y = y
  5.  
  6.     def __repr__(self):
  7.         return 'Par({0.x!r}, {0.y!r})'.format(self)
  8.  
  9.     def __str__(self):
  10.         return '({0.x!s}, {0.y!s})'.format(self)
  11.  
  12. par = Par(2, 3)
  13.  
  14. par
  15.  
  16. print(par)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement