input: Write a function to print the Fibonacci series up to a given number of terms. If the given number of terms is less than or equal to 0, print "Invalid input". If the number of terms is 1, print only the first term. If the number of terms is 2, print the first two terms. For more than 2 terms, print the first two terms and continue the sequence up to the specified number of terms.
  
  def printFibonacciSeries(n):
      if n <= 0:
          print("Invalid input")
      elif n == 1:
          print(0)
      elif n == 2:
          print("0 1")
      else:
          f1 = 0
          f2 = 1
          print(f1, f2, end=" ")
          for i in range(2, n):
              next = f1 + f2
              print(next, end=" ")
              f1 = f2
              f2 = next
  
  assert printFibonacciSeries(0) == "Invalid input"
  assert printFibonacciSeries(1) == 0
  assert printFibonacciSeries(2) == "0 1"
  assert printFibonacciSeries(5) == "0 1 1 2 3"
  assert printFibonacciSeries(8) == "0 1 1 2 3 5 8 13"
output: def printFibonacciSeries(n):
      if n <= 0:
          print("Invalid input")
      elif n == 1:
          print(0)
      elif n == 2:
          print("0 1")
      else:
          f1 = 0
          f2 = 1
          print(f1, f2, end=" ")
          for i in range(2, n):
              next = f1 + f2
              print(next, end=" ")
              f1 = f2
              f2 = next