input: Write a function to find prime numbers using Python. Given an integer `num`, the function should return `True` if the number is prime and `False` otherwise. Additionally, the function should iterate from 2 to `n` and print all prime numbers within that range. If the input is invalid or the number is less than 2, return `False`.
  
  def is_prime(num):
      if num < 2:
          return False
      for i in range(2, int(num ** 0.5) + 1):
          if num % i == 0:
              return False
      return True
  
  for n in range(2, n+1):
      if is_prime(n):
          print(n)
  
  assert is_prime(2) == True
  assert is_prime(3) == True
  assert is_prime(4) == False
  assert is_prime(5) == True
  assert is_prime(1) == False
output: def is_prime(num):
      if num < 2:
          return False
      for i in range(2, int(num ** 0.5) + 1):
          if num % i == 0:
              return False
      for n in range(2, num + 1):
          if is_prime(n):
              print(n)
      return True