From 6f9e4eb0268af0c87afdcd5a165a2b1c7f087705 Mon Sep 17 00:00:00 2001 From: Marco Torres Date: Tue, 15 Aug 2023 19:22:54 -0700 Subject: [PATCH] Reto #16 - Python --- .../python/marcoatrs.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Retos/Reto #16 - LA ESCALERA [Media]/python/marcoatrs.py diff --git a/Retos/Reto #16 - LA ESCALERA [Media]/python/marcoatrs.py b/Retos/Reto #16 - LA ESCALERA [Media]/python/marcoatrs.py new file mode 100644 index 0000000000..a6fe59caf4 --- /dev/null +++ b/Retos/Reto #16 - LA ESCALERA [Media]/python/marcoatrs.py @@ -0,0 +1,21 @@ +def dibujar_escalera(escalones: int): + if escalones == 0: + print("__") + return + + if escalones > 0: + for step in range(escalones, 0, -1): + space = " " * (2 * step) + if step == (escalones): + print(f"{space}_") + print(f"{space[:-2]}_|") + + else: + for step in range(abs(escalones)): + space = " " * (2 * step + 1) + if step == 0: + print(f"_") + print(f"{space}|_") + + +dibujar_escalera(0)