针对给定的一段代码，进行调试并修复其错误。
以下是一段Python代码。
def is_prime(num):
    for n in range(2, num):
        if num % n == 0:
            print(num, "is not prime")
            break
    else:
        print(num, "is prime")
is_prime(10)
is_prime(11)
is_prime(12)
存在一个逻辑错误，导致判断质数时输出结果非常错误。对于数字2默认认为是质数，当num=2时循环将不执行，因此输出结果错误。解决这个问题可以在for循环中将范围调整为：

```python
for n in range(2, num+1):
``` 

修复后的代码:

```python
def is_prime(num):
    if num < 2: # 1和负数不是质数
        print(num, "is not prime")
    else:
        for n in range(2, num+1):
            if num % n == 0 and num != n:
                print(num, "is not prime")
                break
        else:
            print(num, "is prime")

is_prime(2) # should print "2 is prime"
is_prime(10) # should print "10 is not prime"
is_prime(11) # should print "11 is prime"
is_prime(-3) # should print "-3 is not prime"
```