diff --git a/Multiply.py b/Multiply.py index c8e1b52228f..d8d06ffd50a 100644 --- a/Multiply.py +++ b/Multiply.py @@ -1,4 +1,8 @@ def product(a, b): + # for negative vals, return the negative result of its positive eval + if b < 0: + return -product(a, -b) + if a < b: return product(b, a) elif b != 0: @@ -9,4 +13,4 @@ def product(a, b): a = int(input("Enter first number: ")) b = int(input("Enter second number: ")) -print("Product is: ", product(a, b)) +print("Product is:", product(a, b))