This solution looks clean enough to me, but I'd point out that you only have to check up to int(num**.5)+1