Created
November 7, 2022 19:49
-
-
Save onejohi/b9f882f6db6196d0be8ca73fb27262a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a custom made Python function/method I made that accepts an array value and calculates the variance | |
def variance(array_value): | |
sum = 0 | |
for i in array_value: | |
sum += i | |
mean = sum / len(array_value) | |
difference_value = 0 | |
for j in array_value: | |
difference = mean - j | |
square_value = difference ** 2 | |
difference_value += square_value | |
return difference_value / len(array_value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment