# zylos/stats.py

import math

def mean(data):
    """Returns the average of a list of numbers."""
    return sum(data) / len(data)

def hypotenuse(a, b):
    """Calculates the long side of a right triangle."""
    return math.sqrt(a**2 + b**2)

def percentage_change(old, new):
    """Calculates % increase or decrease."""
    return ((new - old) / old) * 100

def solve_quadratic(a, b, c):
    """Solves for x in ax^2 + bx + c = 0"""
    discriminant = b**2 - 4*a*c
    
    if discriminant < 0:
        return "No real roots (they are imaginary!)"
    
    x1 = (-b + math.sqrt(discriminant)) / (2 * a)
    x2 = (-b - math.sqrt(discriminant)) / (2 * a)
    
    return x1, x2