Can you build an algorithm in Python to check whether a given number is a prime or not?
7
def is_prime(num):
    if num < 2:
        return False
    for i in range(2, num):
        if num % i == 0:
            return False
    return True

print(is_prime(7))