We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5b086f7 commit f673191Copy full SHA for f673191
Multiply.py
@@ -1,4 +1,8 @@
1
def product(a, b):
2
+ # Handle negative values
3
+ if b < 0:
4
+ return -product(a, -b)
5
+
6
if a < b:
7
return product(b, a)
8
elif b != 0:
@@ -9,4 +13,4 @@ def product(a, b):
9
13
10
14
a = int(input("Enter first number: "))
11
15
b = int(input("Enter second number: "))
12
-print("Product is: ", product(a, b))
16
+print("Product is:", product(a, b))
0 commit comments