Advertisement
Guest User

Banque

a guest
Nov 13th, 2019
921
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. from compte_simple import CompteSimple
  2.  
  3. class Banque:
  4. '''TODO'''
  5.  
  6. def __init__(self):
  7. self.comptes = []
  8.  
  9. def ouverture_compte(self, titulaire, depot_initial):
  10. compte = CompteSimple(titulaire, depot_initial)
  11. self.comptes.append(compte)
  12. return compte
  13.  
  14.  
  15. def total_compte(self):
  16. somme_comptes = 0
  17. for compte in self.comptes:
  18. somme_comptes += compte.solde
  19. return somme_comptes
  20.  
  21. def prelevement_frais(self, pourcentage_frais):
  22. for compte in self.comptes:
  23. frais = (compte.solde * pourcentage_frais)
  24. compte.solde -= frais
  25.  
  26. def __repr__(self):
  27. return repr(f"banque : {self.comptes}")
  28.  
  29. def __str__(self):
  30. return f"comptes : {self.comptes}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement