The code isn't working properly for numbers like 4,9...

```
def is_prime(x):
if x<2:
return False
elif x==2:
return True
else:
for i in range(2,x):
if x%i==0:
prime=0
else:
prime=1
if prime ==1:
return True
else:
return False
```