Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1.  
  2.  
  3. class Domino :
  4.  
  5.     # Constructeur
  6.     def __init__(self, A=0, B=0):
  7.         self.A = A
  8.         self.B = B
  9.  
  10.     # Méthode
  11.     def affiche_points(self):
  12.         print ("Premiere face A : {}\nDeuxieme face B : {}".format(self.A,self.B))
  13.  
  14.     def valeur(self):
  15.         somme = self.A + self.B
  16.         return somme
  17.  
  18. d1 = Domino(2,6)
  19. d2 = Domino(3,2)
  20. d3 = Domino(4,3)
  21. d1.affiche_points()
  22. d2.affiche_points()
  23. print "Somme total des points :", d1.valeur() + d2.valeur()
  24.  
  25. liste_de_7_dominos = []
  26. for i in range(7):
  27.     liste_de_7_dominos.append(Domino(6, i))
  28. print liste_de_7_dominos
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement