From 2ab5c2049cc821964272d82d070e1033da6927ca Mon Sep 17 00:00:00 2001 From: defterade <11379144+defterade@users.noreply.github.com> Date: Sun, 22 Sep 2019 21:32:51 +0200 Subject: [PATCH] [ENHANCEMENT] Use and instead of bitwise and and is faster --- snippets/factorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/factorial.md b/snippets/factorial.md index 33af36157..d66ab2cd4 100644 --- a/snippets/factorial.md +++ b/snippets/factorial.md @@ -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)