"""
To master this you should consider using the builtin-``min``-function.
"""
from ...challenge import Challenge
from random import randint


x = []
for _ in range(randint(2, 10)):
    x.append(randint(1, 100))

intro = f"You have to print the lowest value of {', '.join(str(_) for _ in x[:-1])} and {x[-1]}. (values: x)"


def validate_function(stdin: str, stdout: str, stderr: str, exc: tuple) -> bool:
    try:
        z = int(stdout.removesuffix("\n"))
    except ValueError:
        return False
    else:
        return min(x) == z


challenge = Challenge(
    intro=intro,
    validate_function=validate_function,
    help=__doc__,
    values={"x": x},
    capture_stdout=True,
)

[((9, 15, 9, 29), 'random.randint', 'randint', ({(9, 23, 9, 24): '(2)', (9, 26, 9, 28): '(10)'}, {}), '(2, 10)', False, 'from random import randint\n'), ((10, 13, 10, 28), 'random.randint', 'randint', ({(10, 21, 10, 22): '(1)', (10, 24, 10, 27): '(100)'}, {}), '(1, 100)', False, 'from random import randint\n')]