Write a python function to calculate weighted average of two or more numbers


Topic: Write a python function to calculate weighted average of two or more numbers

Solution

def weighted_average(nums, weights):
  return sum(x * y for x, y in zip(nums, weights)) / sum(weights)



List all Python Programs