input: Write a function to print all prime numbers between 1 and a given number n. If n is less than 2, print "Invalid input". If n is valid, print each prime number on a new line.
  def print_primes_till_n(n):
      if n < 2:
          print("Invalid input")
          return
  
      prime_list = [True for i in range(n + 1)]
      p = 2
      while (p * p <= n):
          if (prime_list[p] == True):
              for i in range(p * 2, n + 1, p):
                  prime_list[i] = False
          p += 1
  
      for p in range(2, n):
          if prime_list[p]:
              print(p)
  
  assert print_primes_till_n(10) == None  # Should print: 2, 3, 5, 7
  assert print_primes_till_n(2)  == None  # Should print: Invalid input
  assert print_primes_till_n(5)  == None  # Should print: 2, 3
output: def print_primes_till_n(n):
      if n < 2:
          print("Invalid input")
          return
  
      prime_list = [True for i in range(n + 1)]
      p = 2
      while (p * p <= n):
          if (prime_list[p] == True):
              for i in range(p * 2, n + 1, p):
                  prime_list[i] = False
          p += 1
  
      for p in range(2, n):
          if prime_list[p]:
              print(p)