I made a function that takes an argument `x` and returns `True` if `x` is a prime number and `False` if `x` is a non-prime number.

I am a beginner and think the code can be improved. I had to add the else statement because for `is_prime(2)`, I kept getting `None` instead of `True`. I think this was because when `x` is `2`, `list_n = range(2,2)` prints `[]`. 

Are there ways I could change this so there is not a separate else statement?

```
def is_prime(x):
    list_n = range(2,x)

    if x <= 1:
        return False
    elif x-1>2:
        for n in range(len(list_n)):
            list_n[n] = x % list_n[n]
        for n in list_n:
            if n == 0:
                return False
        for n in list_n:
            if n > 0:
                return True
    else:
        return True

```