From fd30895a4210172bedcdcbf25e7aa71b4ce724f4 Mon Sep 17 00:00:00 2001 From: Mykhailo Date: Sun, 20 Apr 2025 22:57:09 +0200 Subject: [PATCH] Update 04_task_symbols.md --- Lesson20/pactice/part01/04_task_symbols.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Lesson20/pactice/part01/04_task_symbols.md b/Lesson20/pactice/part01/04_task_symbols.md index e085880..3269037 100644 --- a/Lesson20/pactice/part01/04_task_symbols.md +++ b/Lesson20/pactice/part01/04_task_symbols.md @@ -33,5 +33,23 @@ rows = 2 ### Решение задачи ```python -# TODO: you code here... -``` \ No newline at end of file +def print_rhombus_outline(rows: int): + for i in range(rows - 1, -1, -1): + spaces_outside = rows - 1 - i + spaces = 2 * i + 1 + if i != 0: + print(" " * spaces_outside + "*" * spaces) + + for i in range(rows): + spaces_outside = rows - 1 - i + if i == 0: + print(" " * spaces_outside + "*") + else: + spaces = 2 * i + 1 + print(" " * spaces_outside + "*" * spaces) + + +rows = int(input("2 <= rows <= 15: ")) + +print_rhombus_outline(rows) +```