fork download
  1. from enum import Enum
  2.  
  3. class Jokenpo(Enum):
  4. PEDRA = 1
  5. PAPEL = 2
  6. TESOURA = 3
  7.  
  8. @property
  9. def weakness(self):
  10. if self == self.PEDRA:
  11. return self.PAPEL
  12. elif self == self.PAPEL:
  13. return self.TESOURA
  14. else:
  15. return self.PEDRA
  16.  
  17. print(Jokenpo.PEDRA.weakness)
  18. print(Jokenpo.PAPEL.weakness)
  19. print(Jokenpo.TESOURA.weakness)
Success #stdin #stdout 0.04s 9376KB
stdin
Standard input is empty
stdout
Jokenpo.PAPEL
Jokenpo.TESOURA
Jokenpo.PEDRA