python AttributeError: module 'math' has no attribute 'comb'

Viewed 7179

I'm getting an error when I try to use the 'comb' function:

$ 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'
>>> 
1 Answers

The comb function is new in Python 3.8 (see documentation here). Your Python installation is 3.7.1. If you update your Python installation, the issue should be resolved.

Related