<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _mean_var(vals, pmf):
 """ Calculates the mean and variance from vals and pmf Parameters vals : ndarray Value range for a distribution pmf : ndarray pmf values corresponding with vals Returns ------- : tuple (mean, variance) """


    mean = np.sum(vals * pmf)
    var = np.sum(vals ** 2 * pmf) - mean ** 2
    return mean, var