tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
9
Task/Pascals-triangle/Python/pascals-triangle-1.py
Normal file
9
Task/Pascals-triangle/Python/pascals-triangle-1.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
def pascal(n):
|
||||
"""Prints out n rows of Pascal's triangle.
|
||||
It returns False for failure and True for success."""
|
||||
row = [1]
|
||||
k = [0]
|
||||
for x in range(max(n,0)):
|
||||
print row
|
||||
row=[l+r for l,r in zip(row+k,k+row)]
|
||||
return n>=1
|
||||
Loading…
Add table
Add a link
Reference in a new issue