Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. class Programa:
  2. def __init__(self, nome, ano):
  3. self._nome = nome
  4. self.ano = ano
  5. self._likes = 0
  6.  
  7. @property
  8. def nome(self):
  9. return self._nome.title()
  10.  
  11. @nome.setter
  12. def nome(self, novo_nome):
  13. self._nome = novo_nome
  14.  
  15. def dar_likes(self):
  16. self._likes += 1
  17.  
  18. @property
  19. def likes(self):
  20. return self._likes
  21.  
  22.  
  23. class Filme(Programa):
  24. def __init__(self, nome, ano, duracao):
  25. super().__init__('vingadores ultimato', 2018)
  26. self.duracao = 200
  27.  
  28. class Serie(Programa):
  29. def __init__(self, nome, ano, temporadas):
  30. super().__init__('mr robot', 2015)
  31. self.temporadas = temporadas
  32.  
  33.  
  34. vingadores = Filme('vingadores - guerra inifinita', 2018, 200)
  35. vingadores.nome = 'vingadores ultimato'
  36. mrrobot = Serie('mr robot', 2015, 3)
  37. vingadores.dar_likes()
  38. vingadores.dar_likes()
  39. vingadores.dar_likes()
  40. mrrobot.dar_likes()
  41. mrrobot.dar_likes()
  42. mrrobot.dar_likes()
  43. mrrobot.dar_likes()
  44.  
  45. print(f'{vingadores.nome} - {vingadores.duracao} - {vingadores.ano} - {vingadores.likes}')
  46. print(f'{mrrobot.nome} - {mrrobot.temporadas} - {mrrobot.ano} - {mrrobot.likes}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement