Yixuan is trying to write runes to fight off the monsters coming from the Hollow, but she can't keep up with the amount of monsters coming, so she feels overwhelmed and trying to find another way to create runes. That's when you step in and offer to create her runes with a generator.

After a quick survey, you found out that her runes's cryptic characters are actually numbers following a very special pattern called a Pascal's triangle.
Pascal's triangle is a triangular array where each row starts and ends with 1, and every other entry is the sum of the two entries directly above it. Row k (counting from 0) holds the binomial coefficients C(k, 0), C(k, 1), ..., C(k, k).
How the next row is built from the previous one:
Your job is to write a generator function pascal_triangle() that lazily yields the rows of Pascal's triangle one at a time, as Python lists, starting from row 0 ([1]), and never terminates by itself (an infinite generator) so Yixuan can use it.
The function must use yield (it must be a real generator, not a function that builds a list of all rows).
def pascal_rows():
"""Infinite generator of Pascal's triangle rows as lists of ints.
Row 0 is [1]."""
# TODO: use yield (do not build a list of all rows)
pass
#-------- DO NOT CHANGE BELOW -------------
from itertools import islice
import inspect
def main():
n = int(input())
if not inspect.isgeneratorfunction(gen_obj):
print("Not a generator")
return
for row in islice(pascal_rows(), n):
print(" ".join(map(str, row)))
if __name__ == "__main__":
main()
One integer n: how many rows to print.
The first n rows (rows 0 to n-1), one row per line, numbers separated by single spaces.