With the help of sympy.stats.P()
method, we can find the probability of an occasion or a hypothetical situation by using sympy.stats.P()
method.
Syntax :
sympy.stats.P(function)
Return : Return the probability of a hypothesis.
Example #1 :
In this example we can see that by using sympy.stats.P()
method, we are able to find the probability of an hypothetical situation by using this method.
# Import sympy, P, Dice from sympy.stats import P, Die
situation = Die( 'X' , 2 )
# Using stats.P() method gfg = P(situation < 5 )
print (gfg)
|
Output :
1
Example #2 :
# Import sympy, P, Dice from sympy.stats import P, Die
situation = Die( 'X' , 6 )
# Using stats.P() method gfg = P(situation > 3 )
print (gfg)
|
Output :
1/2