# Arup Guha
# 12/1/2020
# Example of continue statement

import statistics

# More made up data.
data = [50, 60, 55, 55, 59, 99, 45, 77, 63, 100, 45, 43, 65, 57, 59, 55]

avg = statistics.mean(data)
spread = statistics.stdev(data)

# New list where we remove the outliers, who are more than 2 stdevs from the
# mean
dataNoOutliers = []

# Go through each item in data.
for x in data:

    # Get rid of bad data.
    if x > avg + 2*spread:
        print(x,"was removed since it is too high.")
        continue
    elif x < avg - 2*spread:
        print(x,"was removed since it was too low.")
        continue

    # This is our data without outliers, if we get here, add x.
    dataNoOutliers.append(x)

print("The old mean was",avg,"without outliers it is",statistics.mean(dataNoOutliers))
