# Code poker dice

#1

Im trying to launch 5 dice one time, and return result such as ARDVX9
A is As , R king, D damme, V valet, X 10 and 9
here is my code,.

def lancer_des(lancee):
"""

``````des_1,des_2,des_3,des_4,des_5 =["A", "R", "D", "V", "X", "9"]
choix={1:des_1,2:des_2,3:des_3,4:des_4,5:des_5}
while max_lancee == 1:
if lancee > max_lancee:
print("Trop grand, termine")
else:

print("Votre combinaison",)
lancee = random["A", "R", "D", "V", "X", "9"]

for i in range(5):
lancee = int(input("Veuillez lancer le des", liste_des))
resultat = liste_des
resultat += [random.choix([1, 2, 3, 4, 5])]  # variante de randint(1,6)
return resultat
print(resultat)``````

#2

We have seen this problem recently, so it must be homework.

Set up a list.

``````import random

faces = ['A', 'R', 'D', 'V', 'X', '9']``````

Generate a deal list,

``````deal = []
while len(deal) < 5:
deal.append(random.choice(faces))
print deal``````

``````>>> import random
>>> faces = ['A', 'R', 'D', 'V', 'X', '9']
>>> deal = []
>>> while len(deal) < 5:
deal.append(random.choice(faces))

>>> deal
['9', 'R', 'A', '9', '9']``````

This is an `nPr` problem, if that means anything. nPr = 6P5 = 720. There are 720 permutations of these five dice, each with six faces.

``nPr = n! / (n - r)! = 6! / (6 - 5)! = 720 / 1 = 720``

Since six of the 720 outcomes are all of a kind, the probability of five of a kind is 1 in 120. Just shy of a one per-cent chance at five of a kind.

What a neat opportunity to tie math to this programming problem!

There is about a five per-cent probability of three-of-a-kind if we do the math.