Practical 1
Practical 1
Department of Mathematics
Probability
Out[1]: 5.7
In [2]: simulate(100)
Out[2]: 4.83
In [8]: probability_of_even(set_of_numbers)
Out[8]: 0.45454545454545453
In [9]: probability_of_prime(set_of_numbers)
Out[9]: 0.45454545454545453
In [10]: probability_divisible(set_of_numbers)
Out[10]: 0.09090909090909091
Conditional Probability
0.3333333333333333
Out[10]:
sport Baseball Basketball Football Soccer All
gender
Female 34 52 20 44 150
Male 34 40 58 18 150
All 68 92 78 62 300
Out[11]: 34
In [12]: #calculate probability of being male, given that individual prefers baseball
survey_data.iloc[1, 0] / survey_data.iloc[2, 0]
Out[12]: 0.5
Out[13]: 0.6133333333333333
In [ ]: