-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pascals-triangle: update tests to canonical-date v1.2.0 (#1164)
- Loading branch information
1 parent
1c03092
commit 54c9694
Showing
3 changed files
with
56 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
def triangle(nth): | ||
return [row(i) for i in range(nth + 1)] | ||
|
||
|
||
def is_triangle(t): | ||
new_t = triangle(len(t) - 1) | ||
return t == new_t | ||
|
||
|
||
def row(nth): | ||
r = [1] | ||
for i in range(1, nth + 1): | ||
r.append(int(r[-1] * (nth - i + 1) / i)) | ||
return " ".join([str(i) for i in r]) | ||
def rows(row_count): | ||
if row_count < 0: | ||
return None | ||
elif row_count == 0: | ||
return [] | ||
r = [] | ||
for i in range(row_count): | ||
rn = [1] | ||
for j in range(i): | ||
rn.append(sum(r[-1][j:j+2])) | ||
r.append(rn) | ||
return r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,2 @@ | ||
def triangle(row_count): | ||
pass | ||
|
||
|
||
def is_triangle(triangle_rows_list): | ||
pass | ||
|
||
|
||
def row(row_count): | ||
def rows(row_count): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters