Cody Bable

Generation

generate functionTue, 25 Apr 2023

calculate the product of m x n but without using the * operator

def mul(a, b): if a < 0 or b < 0: raise ValueError("Inputs must be non-negative integers.") elif a == 0 or b == 0: return 0 else: return a + mul(a, b - 1)

Questions about programming?Chat with your personal AI assistant