Generate a function in Python that takes a natural number as argument and returns the product of all numbers up to it.
n = 4
def getProduct(n):
  result = 1
  for i in range(n):
    result *= i+1
    
  return result