input: Write a function to determine if a given number is a prime number. If it is a prime number, return True; otherwise, return False. Ensure the function works correctly for both odd and even numbers. If the number is less than 2, return False. Finally, provide a code snippet that prints all prime numbers up to a given limit.
  
  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 num > 1
  
  assert is_prime(2) == True
  assert is_prime(4) == False
  assert is_prime(11) == True
  assert is_prime(1) == False
  assert is_prime(0) == False
  assert is_prime(-5) == False
  
  # Iterate from 2 to n
  n = 20
  for n in range(2, n+1):
      # Check if the number is prime
      if is_prime(n):
          print(n)
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
      return True