sympy.stats.Die() function in Python

With the help of sympy.stats.Die() method, we can get the fair die having number of faces given by the parameter and having name defined in the parameter itself by using sympy.stats.Die() method.

Syntax : sympy.stats.Die(name, faces)
Return : Return a fair die having ‘n’ faces.

Example #1 :
In this example, we can see that by using sympy.stats.Die() method, we are able to get the fair die having ‘n’ faces passed as a parameter by using this method.




# Import sympy and Die
from sympy.stats import Die, density
  
X = Die('X', 12)
# Using sympy.Die() method
gfg = density(X).dict
  
print(gfg)


Output :

{1: 1/12, 2: 1/12, 3: 1/12, 4: 1/12, 5: 1/12, 6: 1/12, 7: 1/12, 8: 1/12, 9: 1/12, 10: 1/12, 11: 1/12, 12: 1/12}

Example #2 :




# Import sympy and Die
from sympy.stats import Die, density
  
X = Die('X', 3)
# Using sympy.Die() method
gfg = density(X).dict
  
print(gfg)


Output :

{1: 1/3, 2: 1/3, 3: 1/3}