题解 | 泊松分布概率计算器

泊松分布概率计算器

https://www.nowcoder.com/practice/62cefdecf3554378a8c2cd9f77faa13c

import math
from scipy.stats import poisson

def poisson_probability(k, lam):
	"""
	Calculate the probability of observing exactly k events in a fixed interval,
	given the mean rate of events lam, using the Poisson distribution formula.
	:param k: Number of events (non-negative integer)
	:param lam: The average rate (mean) of occurrences in a fixed interval
	"""
	# Your code here

	return round(poisson.pmf(k,lam),5)
	

if __name__ == "__main__":
    k, lam = map(int, input().split())
    print(poisson_probability(k, lam))

全部评论

相关推荐

团子请爱我一次_十月...:不是戈门,干哪来了,这就是java嘛
点赞 评论 收藏
分享
渴望wlb的牛油果很...:直说卡第一学历不就行了 非得拐弯抹角
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务