Check prime number

Write a function named is_prime that takes an integer n as input and returns True if n is a prime number; otherwise, return False. Use a for loop.

A prime number is an integer greater than 1 whose only positive divisors are 1 and itself.

Complete the supplied function in Listing 1. Keep its signature and use the checks below it.

Listing 1: Starter function and supplied checks for check prime number.
def is_prime(n: int) -> bool:
    # Add code here!
    pass


assert is_prime(7) is True
assert is_prime(4) is False
assert is_prime(17) is True

range(start, stop) supplies integers beginning at start and ending before stop. For example, list(range(1, 4)) is [1, 2, 3]. An empty range supplies no values.

assert condition stops the check with an AssertionError when the condition is false. The % operator gives the remainder after division; 6 % 3 is 0.