import os
def file_exists(file_path):
return os.path.isfile(file_path)
import os
def directory_exists(directory_path):
return os.path.isdir(directory_path)
def find_median(dataset):
sorted_list = sorted(dataset)
length = len(sorted_list)
if length % 2 == 0:
return (sorted_list[length // 2 - 1] + sorted_list[length // 2]) / 2
else:
return sorted_list[length // 2]
def calculate_variance(data):
mean = sum(data) / len(data)
return sum((x - mean) ** 2 for x in data) / len(data)
def calculate_std_deviation(data):
variance = calculate_variance(data)
return variance ** 0.5