first for the faulty code, lets say
x=9, then the first case for 9 which is tested is 2:
if 9 % 2 == 0
this is false, so now
else will run, which returns True. The moment a return keyword is reached, a function ends. Even when in a loop, the loop will simply break.
so, with the faulty code, the loop always ends in its first iteration.
True should only be returned after the loop has finished running, when you have
for/else, else will run when the loop condition becomes false (loop finishes running), if the number is not a prime number, at some point in the loop, False will be returned loop breaks and the function ends