def function(nums, weights):
    total = 0
    total_weights = 0
    for i in range(0, len(nums)):
        total += nums[i] * weights[i]
        total_weights += weights[i]
    return total / total_weights
