当我尝试使用'comb‘函数时,我得到了一个错误:
$ python
Python 3.7.1 (default, Dec 14 2018, 13:28:58)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> print(math.comb(6,49))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'math' has no attribute 'comb'
>>> 发布于 2021-04-16 16:31:49
comb函数是Python3.8中的新功能(请参阅文档here)。您的Python安装版本是3.7.1。如果您更新您的Python安装,这个问题应该会得到解决。
https://stackoverflow.com/questions/67121494
复制相似问题