input: Write a function to generate all prime numbers up to a given number n. The function should print each prime number found.
  
  def generate_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)
  
  # Example test cases
  generate_primes(10)  # Expected output: 2, 3, 5, 7
  generate_primes(20)  # Expected output: 2, 3, 5, 7, 11, 13, 17, 19
output: def generate_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)