@treyhunner not linking this as a reply because I am not sure why I felt compelled to do this and it may be a bit confusing to your target audience, but; I prefer to treat things as expressions rather than early returns when I can, to wit::
def is_prime(candidate: int) -> bool:
factors = (n for n in range(2, candidate) if candidate % n == 0)
return next(factors, None) is None