title graham s law of effusion description graham s law of effusion states that the rate of effusion of a gas is inversely proportional to the square root of the molar mass of its particles r1r2 sqrtm2m1 r1 rate of effusion for the first gas r2 rate of effusion for the second gas m1 molar mass of the first gas m2 molar mass of the second gas description adapted from https en wikipedia orgwikigraham27slaw input parameters effusionrate1 effustion rate of first gas m2s mm2s etc effusionrate2 effustion rate of second gas m2s mm2s etc molarmass1 molar mass of the first gas gmol kgkmol etc molarmass2 molar mass of the second gas gmol kgkmol etc returns validate2 016 4 002 true validate2 016 4 002 false validate false input parameters molarmass1 molar mass of the first gas gmol kgkmol etc molarmass2 molar mass of the second gas gmol kgkmol etc returns effusionratio2 016 4 002 1 408943 effusionratio2 016 4 002 valueerror input error molar mass values must greater than 0 effusionratio2 016 traceback most recent call last typeerror effusionratio missing 1 required positional argument molarmass2 input parameters effusionrate effustion rate of second gas m2s mm2s etc molarmass1 molar mass of the first gas gmol kgkmol etc molarmass2 molar mass of the second gas gmol kgkmol etc returns firsteffusionrate1 2 016 4 002 1 408943 firsteffusionrate1 2 016 4 002 valueerror input error molar mass and effusion rate values must greater than 0 firsteffusionrate1 traceback most recent call last typeerror firsteffusionrate missing 2 required positional arguments molarmass1 and molarmass2 firsteffusionrate1 2 016 traceback most recent call last typeerror firsteffusionrate missing 1 required positional argument molarmass2 input parameters effusionrate effustion rate of second gas m2s mm2s etc molarmass1 molar mass of the first gas gmol kgkmol etc molarmass2 molar mass of the second gas gmol kgkmol etc returns secondeffusionrate1 2 016 4 002 0 709752 secondeffusionrate1 2 016 4 002 valueerror input error molar mass and effusion rate values must greater than 0 secondeffusionrate1 traceback most recent call last typeerror secondeffusionrate missing 2 required positional arguments molarmass1 and molarmass2 secondeffusionrate1 2 016 traceback most recent call last typeerror secondeffusionrate missing 1 required positional argument molarmass2 input parameters molarmass molar mass of the first gas gmol kgkmol etc effusionrate1 effustion rate of first gas m2s mm2s etc effusionrate2 effustion rate of second gas m2s mm2s etc returns firstmolarmass2 1 408943 0 709752 0 507524 firstmolarmass1 2 016 4 002 valueerror input error molar mass and effusion rate values must greater than 0 firstmolarmass1 traceback most recent call last typeerror firstmolarmass missing 2 required positional arguments effusionrate1 and effusionrate2 firstmolarmass1 2 016 traceback most recent call last typeerror firstmolarmass missing 1 required positional argument effusionrate2 input parameters molarmass molar mass of the first gas gmol kgkmol etc effusionrate1 effustion rate of first gas m2s mm2s etc effusionrate2 effustion rate of second gas m2s mm2s etc returns secondmolarmass2 1 408943 0 709752 1 970351 secondmolarmass2 1 408943 0 709752 valueerror input error molar mass and effusion rate values must greater than 0 secondmolarmass1 traceback most recent call last typeerror secondmolarmass missing 2 required positional arguments effusionrate1 and effusionrate2 secondmolarmass1 2 016 traceback most recent call last typeerror secondmolarmass missing 1 required positional argument effusionrate2 input parameters effusion_rate_1 effustion rate of first gas m 2 s mm 2 s etc effusion_rate_2 effustion rate of second gas m 2 s mm 2 s etc molar_mass_1 molar mass of the first gas g mol kg kmol etc molar_mass_2 molar mass of the second gas g mol kg kmol etc returns validate 2 016 4 002 true validate 2 016 4 002 false validate false input parameters molar_mass_1 molar mass of the first gas g mol kg kmol etc molar_mass_2 molar mass of the second gas g mol kg kmol etc returns effusion_ratio 2 016 4 002 1 408943 effusion_ratio 2 016 4 002 valueerror input error molar mass values must greater than 0 effusion_ratio 2 016 traceback most recent call last typeerror effusion_ratio missing 1 required positional argument molar_mass_2 input parameters effusion_rate effustion rate of second gas m 2 s mm 2 s etc molar_mass_1 molar mass of the first gas g mol kg kmol etc molar_mass_2 molar mass of the second gas g mol kg kmol etc returns first_effusion_rate 1 2 016 4 002 1 408943 first_effusion_rate 1 2 016 4 002 valueerror input error molar mass and effusion rate values must greater than 0 first_effusion_rate 1 traceback most recent call last typeerror first_effusion_rate missing 2 required positional arguments molar_mass_1 and molar_mass_2 first_effusion_rate 1 2 016 traceback most recent call last typeerror first_effusion_rate missing 1 required positional argument molar_mass_2 input parameters effusion_rate effustion rate of second gas m 2 s mm 2 s etc molar_mass_1 molar mass of the first gas g mol kg kmol etc molar_mass_2 molar mass of the second gas g mol kg kmol etc returns second_effusion_rate 1 2 016 4 002 0 709752 second_effusion_rate 1 2 016 4 002 valueerror input error molar mass and effusion rate values must greater than 0 second_effusion_rate 1 traceback most recent call last typeerror second_effusion_rate missing 2 required positional arguments molar_mass_1 and molar_mass_2 second_effusion_rate 1 2 016 traceback most recent call last typeerror second_effusion_rate missing 1 required positional argument molar_mass_2 input parameters molar_mass molar mass of the first gas g mol kg kmol etc effusion_rate_1 effustion rate of first gas m 2 s mm 2 s etc effusion_rate_2 effustion rate of second gas m 2 s mm 2 s etc returns first_molar_mass 2 1 408943 0 709752 0 507524 first_molar_mass 1 2 016 4 002 valueerror input error molar mass and effusion rate values must greater than 0 first_molar_mass 1 traceback most recent call last typeerror first_molar_mass missing 2 required positional arguments effusion_rate_1 and effusion_rate_2 first_molar_mass 1 2 016 traceback most recent call last typeerror first_molar_mass missing 1 required positional argument effusion_rate_2 input parameters molar_mass molar mass of the first gas g mol kg kmol etc effusion_rate_1 effustion rate of first gas m 2 s mm 2 s etc effusion_rate_2 effustion rate of second gas m 2 s mm 2 s etc returns second_molar_mass 2 1 408943 0 709752 1 970351 second_molar_mass 2 1 408943 0 709752 valueerror input error molar mass and effusion rate values must greater than 0 second_molar_mass 1 traceback most recent call last typeerror second_molar_mass missing 2 required positional arguments effusion_rate_1 and effusion_rate_2 second_molar_mass 1 2 016 traceback most recent call last typeerror second_molar_mass missing 1 required positional argument effusion_rate_2
from math import pow, sqrt


def validate(*values: float) -> bool:
    
    result = len(values) > 0 and all(value > 0.0 for value in values)
    return result


def effusion_ratio(molar_mass_1: float, molar_mass_2: float) -> float | ValueError:
    
    return (
        round(sqrt(molar_mass_2 / molar_mass_1), 6)
        if validate(molar_mass_1, molar_mass_2)
        else ValueError("Input Error: Molar mass values must greater than 0.")
    )


def first_effusion_rate(
    effusion_rate: float, molar_mass_1: float, molar_mass_2: float
) -> float | ValueError:
    
    return (
        round(effusion_rate * sqrt(molar_mass_2 / molar_mass_1), 6)
        if validate(effusion_rate, molar_mass_1, molar_mass_2)
        else ValueError(
            "Input Error: Molar mass and effusion rate values must greater than 0."
        )
    )


def second_effusion_rate(
    effusion_rate: float, molar_mass_1: float, molar_mass_2: float
) -> float | ValueError:
    
    return (
        round(effusion_rate / sqrt(molar_mass_2 / molar_mass_1), 6)
        if validate(effusion_rate, molar_mass_1, molar_mass_2)
        else ValueError(
            "Input Error: Molar mass and effusion rate values must greater than 0."
        )
    )


def first_molar_mass(
    molar_mass: float, effusion_rate_1: float, effusion_rate_2: float
) -> float | ValueError:
    
    return (
        round(molar_mass / pow(effusion_rate_1 / effusion_rate_2, 2), 6)
        if validate(molar_mass, effusion_rate_1, effusion_rate_2)
        else ValueError(
            "Input Error: Molar mass and effusion rate values must greater than 0."
        )
    )


def second_molar_mass(
    molar_mass: float, effusion_rate_1: float, effusion_rate_2: float
) -> float | ValueError:
    
    return (
        round(pow(effusion_rate_1 / effusion_rate_2, 2) / molar_mass, 6)
        if validate(molar_mass, effusion_rate_1, effusion_rate_2)
        else ValueError(
            "Input Error: Molar mass and effusion rate values must greater than 0."
        )
    )