input: Write a python function to generate a right-angled triangle pattern using nested loops.
  assert generate_triangle(1) == "1\n"
  assert generate_triangle(2) == "1\n2 2\n"
  assert generate_triangle(3) == "1\n2 2\n3 3 3\n"
  assert generate_triangle(4) == "1\n2 2\n3 3 3\n4 4 4 4\n"
output: def generate_triangle(n):
      triangle = ""
      for i in range(1, n + 1):
          triangle += " ".join([str(i)] * i) + "\n"
      return triangle