input: Write a function to rewrite the following code snippet to find prime numbers using Python. The function should check if a number is prime by iterating from 2 to the square root of the number and return True if the number is prime, otherwise return False. The function should then iterate from 2 to n and print all prime numbers.
  def is_prime(num):
      # Iterate from 2 to the square root of the number
      for i in range(2, int(num ** 0.5) + 1):
          if num % i == 0:
              return False
      return True
  
  # Test cases
  assert is_prime(2) == True
  assert is_prime(3) == True
  assert is_prime(4) == False
  assert is_prime(5) == True
  assert is_prime(10) == False
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