input: Write a function to rewrite the code snippet provided to find prime numbers using Python. The function should implement the algorithm that checks if a number is prime by iterating from 2 to the square root of the number. Then, it should print all prime numbers from 2 to a given number n.
  def find_primes(n):
      # Iterate from 2 to the square root of the number
      def is_prime(num):
          for i in range(2, int(num ** 0.5) + 1):
              if num % i == 0:
                  return False
          return True
  
      # Iterate from 2 to n
      for num in range(2, n + 1):
          # Check if the number is prime
          if is_prime(num):
              print(num)
  
  # Example usage:
  find_primes(10)
  assert is_prime(2)==True
  assert is_prime(4)==False
  assert is_prime(7)==True
  assert is_prime(9)==False
  assert find_primes(10)==None
output: def find_primes(n):
      def is_prime(num):
          for i in range(2, int(num ** 0.5) + 1):
              if num % i == 0:
                  return False
          return True
  
      for num in range(2, n + 1):
          if is_prime(num):
              print(num)