import math


def dist(*args):
    """Calculates the Euclidean distance between two points. Arguments are of the form
    dist(x1,y1,x2,y2)
    dist(x1,y1,z1,x2,y2,z2)"""
    if len(args) == 4:
        return math.sqrt(
            sum([(a - b) ** 2 for a, b in zip(args[:2], args[2:])]))
    else:
        assert (len(args) == 6)
        return math.sqrt(
            sum([(a - b) ** 2 for a, b in zip(args[:3], args[3:])]))