Print a complete diamond pattern with '*' characters. Args: n (int): Size of the pattern. Examples: >>> pretty_print(0) ' ... .... nothing printing :(' >>> pretty_print(3) ' * \\n * * \\n* * * \\n* * * \\n * * \\n
(n)
| 53 | |
| 54 | # Function to print complete diamond pattern of "*" |
| 55 | def pretty_print(n): |
| 56 | """ |
| 57 | Print a complete diamond pattern with '*' characters. |
| 58 | |
| 59 | Args: |
| 60 | n (int): Size of the pattern. |
| 61 | |
| 62 | Examples: |
| 63 | >>> pretty_print(0) |
| 64 | ' ... .... nothing printing :(' |
| 65 | |
| 66 | >>> pretty_print(3) |
| 67 | ' * \\n * * \\n* * * \\n* * * \\n * * \\n * \\n ' |
| 68 | """ |
| 69 | if n <= 0: |
| 70 | return " ... .... nothing printing :(" |
| 71 | upper_half = floyd(n) # upper half |
| 72 | lower_half = reverse_floyd(n) # lower half |
| 73 | return upper_half + lower_half |
| 74 | |
| 75 | |
| 76 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected