Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. #coding:utf-8
  2. from random import *
  3.  
  4. class Domino:
  5.     liste = []
  6.  
  7.     def __init__ (self):
  8.         self.a = randint(0, 6)
  9.         self.b = randint(0, 6)
  10.         Domino.liste.append(self)
  11.  
  12.     def affiche_points(self):
  13.         print("face A: {} - face B: {}".format(self.a, self.b))
  14.  
  15.     def valeur(self):
  16.         total = int(self.a) + int(self.b)
  17.         print("total des points : {}".format(total))
  18.  
  19. #--------------------------------------------------------------------
  20. d1 = Domino()
  21. d2 = Domino()
  22. d3 = Domino()
  23.  
  24. # On boucle sur chaque élément (donc objet Domino) de la liste
  25. for dom in Domino.liste:
  26.     print(dom.valeur())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement