I don't know what to expect anymore.

Can somebody help me?

Much appreciated!

My code is down here

```
def is_prime(x):
for num in n:
if x / n = int:
return False
else:
return True
```

I don't know what to expect anymore.

Can somebody help me?

Much appreciated!

My code is down here

```
def is_prime(x):
for num in n:
if x / n = int:
return False
else:
return True
```

try using the remainder symbol to determine if it should return true or false (ex. 4%2 = 0) Since you are trying find if x is prime, you should find the remainder with numbers from 2 till x-1. Use a range function for that.

Also any number less than 2 is going to return false so put an if statement before your for statement.

/ will produce the reminder of the division. Use % to return the integer value of a division.

4/3 = 1.13 while 4%3 = 1.

The conditional check for prime numbers is your syntax would be n%num == 0.

This must be valid for a range of num from 2 to n-1.

def is_prime(x):

```
if x > 1:
for n in range(2,x-1):
print n
print x
if x % n == 0:
return False
else:
return True
else:
return False
```

print is_prime(9)

hahahahaha. dude just chill, it worked for me, so I am just sharing. It might be helpful for others.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.