Z-score standardization

Write codeMedium18 min

Your task

Z-score standardize a non-empty list of numbers: each value becomes (x - mean) / std, where std is the population standard deviation (divide the variance by n, not n-1). If the standard deviation is zero (all values equal), return a list of all 0.0. Round each output to 6 decimal places.

Examples

zscore_normalize(xs: list[float]) -> list[float]
Example 1
Inputzscore_normalize([1, 2, 3])
Output[-1.224745, 0, 1.224745]