Merge pull request #108 from defterade/patch-2

[ENHANCEMENT] Use and instead of bitwise and
This commit is contained in:
Angelos Chalaris
2019-09-23 05:06:38 +03:00
committed by GitHub

View File

@ -12,7 +12,7 @@ Throws an exception if `num` is a negative or a floating point number.
```py
def factorial(num):
if not ((num >= 0) & (num % 1 == 0)):
if not ((num >= 0) and (num % 1 == 0)):
raise Exception(
f"Number( {num} ) can't be floating point or negative ")
return 1 if num == 0 else num * factorial(num - 1)