I have a list:
lst = [10,20,39,50]
How to calculate the probability in Python that a number picked up from the list is not 10? (An event can be supposed)
CodePudding user response:
The probability of getting 10 from the list is just the number of times 10 appears on the list over the length of the list:
p10 = lst.count(10) / len(lst)
Whereas the probability of NOT getting a 10 is just the complement:
p_not10 = 1 - p10