Advertisement
rickyc81

Untitled

Jan 6th, 2018
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. class ContoCorrente:
  2.     def __init__(self, nome, conto, importo):
  3.         self.nome = nome
  4.         self.conto = conto
  5.         self.saldo = importo
  6.  
  7.     def preleva(self, importo):
  8.             self.saldo -= importo
  9.  
  10.     def deposita(self, importo):
  11.             self.saldo += importo
  12.  
  13.     def descrizione(self):
  14.         print(self.nome, self.conto, self.saldo)
  15.  
  16.  
  17.  
  18. c1 = ContoCorrente("Pietro", "10", 2000)
  19. c2 = ContoCorrente("Stefano", "20", 3000)
  20. c3 = ContoCorrente("Annibale", "30", 7000)
  21.  
  22. c1.descrizione()
  23. c2.descrizione()
  24. c3.descrizione()
  25.  
  26.  
  27. c1.deposita(333)
  28. c1.descrizione()
  29.  
  30. c2.preleva(200)
  31. c2.descrizione()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement