input: Write a function to generate the following output pattern using nested loops. The function should print numbers from 1 up to the number of the current line, with each number separated by a space. The output should have 5 lines in total.
  assert generate_pattern()=='1\n12\n123\n1234\n12345\n'
  assert generate_pattern()=='1\n12\n123\n1234\n12345\n'
  assert generate_pattern()=='1\n12\n123\n1234\n12345\n'
  assert generate_pattern()=='1\n12\n123\n1234\n12345\n'
  assert generate_pattern()=='1\n12\n123\n1234\n12345\n'
output: def generate_pattern():
      result = ""
      for i in range(1, 6):
          for j in range(1, i + 1):
              result += str(j)
          result += "\n"
      return result