input: Write a function named is_prime that determines if a given number is a prime number. The function should iterate from 2 to the square root of the number and check if the number is divisible by any of these values. If it is divisible, return False. If no divisors are found, return True. Additionally, create a loop that iterates from 2 to a specified number n and prints all prime numbers within this range.
  
  assert is_prime(2) == True
  assert is_prime(4) == False
  assert is_prime(7) == True
  assert is_prime(15) == False
  assert is_prime(23) == True
output: def is_prime(num):
      if num <= 1:
          return False
      for i in range(2, int(num**0.5) + 1):
          if num % i == 0:
              return False
      return True