Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- class Dice:
- def __init__(self, name):
- self.name = name
- def roll(self):
- value = random.randint(1,6)
- return value
- dice1 = Dice("A")
- dice2 = Dice("B")
- dice3 = Dice("C")
- dice4 = Dice("D")
- dice5 = Dice("E")
- dices =[]
- count = 0
- for i in range(100):
- print("***********")
- dices =[dice1.roll(), dice2.roll(), dice3.roll(), dice4.roll(), dice5.roll()]
- print(dices)
- result = all(x == dices[0] for x in dices)
- if result:
- print(" <<<< YAHTZEE <<<<")
- count += 1
- print(f"\n#########\n{count} yahtzee(s)")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement