Commit ed0afec
committed
Update diamond.py
Add type hint for the return: -> list[str] to make it explicit.
In the middle calculation, len(spaces) could be avoided since spaces is a str of known length—use (letter_index - i) * 2 directly for tiny perf gain, but it's negligible.
Consider adding a check for letter == 'A' early to skip the loop if desired, but the current loop handles it fine.1 parent c9b1bb4 commit ed0afec
1 file changed
+5
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
| 30 | + | |
30 | 31 | | |
31 | | - | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
0 commit comments