I needed to understand the logic behind the problem before understanding how to program it, so I will try to help you out the best I can. The question asks us to define whether or not a number is prime by running it through a set of conditions. Your first two conditions are good. On your third, when you run 9 through it, it stops after one iteration because you return false. Personally, I think a for loop is a bad way to go about this. So, delete everything after "else:"...

Try a while loop and define your variables. The "n" value is the number you divide x (or 9 in this case) by. Therefore, you should set n = n-1 (otherwise it will divide 9/9 and the if statement will return True immediately, saying that 9 is a prime number, when it is not). After defining n, write your while statement. You can do this a number of ways but when I wrote my statement, I had the iterations loop over while n > 1. Therefore, if x = 9, n = 8, and it will loop until n=1.

Once we have the while loop written, we can get to the conditions. You can keep the statement "if x % n == 0: return false". After that we need an else statement that ensures we iterate through every number 9 could be divided by. When you write this else statement, do not include a return statement with it, just update the n value. It should be n= n -1.

Finally, you need a return statement that will return a value after the loop finishes running.