From 98991098477100ccffab8b8cf74c2e7a4512c37a Mon Sep 17 00:00:00 2001 From: TheTosS Date: Sun, 20 Apr 2025 23:44:30 +0200 Subject: [PATCH] Update 04_task_symbols.md --- Lesson20/pactice/part01/04_task_symbols.md | 25 +++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/Lesson20/pactice/part01/04_task_symbols.md b/Lesson20/pactice/part01/04_task_symbols.md index e085880..3b29541 100644 --- a/Lesson20/pactice/part01/04_task_symbols.md +++ b/Lesson20/pactice/part01/04_task_symbols.md @@ -32,6 +32,25 @@ rows = 2 ``` ### Решение задачи -```python -# TODO: you code here... -``` \ No newline at end of file +## "Песочные часы символами" +rows = int(input("rows : ")) + + +def one(i): + for i in range(rows): + if 2 <= rows <= 15: + stars = (rows - i) * 2 - 1 + spaces = i + print(" " * spaces + "*" * stars) + + +def two(j): + for j in range(rows - 2, -1, -1): + + if 2 <= rows <= 15: + stars = (rows - j) * 2 - 1 + spaces = j + print(" " * spaces + "*" * stars) + + +one(1), two(1)