Sympy – stats.P() in Python
Last Updated :
08 Jun, 2020
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.
from sympy.stats import P, Die
situation = Die( 'X' , 2 )
gfg = P(situation < 5 )
print (gfg)
|
Output :
1
Example #2 :
from sympy.stats import P, Die
situation = Die( 'X' , 6 )
gfg = P(situation > 3 )
print (gfg)
|
Output :
1/2
Share your thoughts in the comments
Please Login to comment...