Ad
Code
Diff
  • def multiply(a,b):
        return a*b
    
    • from math import prod
    • def multiply(a, b):
    • ints = (a, b)
    • return prod(ints)
    • result = multiply(5, 10)
    • print(result)
    • def multiply(a,b):
    • return a*b
Code
Diff
  • from functools import reduce
    def multiply (a,b):
        return reduce(lambda a,b:a*b)
        
    • from functools import reduce
    • def multiply (a,b):
    • a * b
    • return reduce(lambda a,b:a*b)