Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Multiply.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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))
Loading