Pascal's triangle: Difference between revisions

Line 1,452:
 
Or, by creating a scan function:
{{incomplete|Python|Need to print the rows in the second example}}
<lang python>def scan(op, seq, it):
a = []
Line 1,466 ⟶ 1,465:
return [l+r for l,r in zip(row+[0,],[0,]+row)]
 
return scan(nextrow, range(n-1), [1,])</lang>
 
for row in pascal(4):
print(row)</lang>
 
=={{header|R}}==
Anonymous user