You're passing the wrong parameter to range()
. Try this in the outermost for
loop:
range(row_ans)
Also notice that the rows
parameter is not being used, delete it from the function declaration and simply call the function like this:
triangle()