Skip to content

Commit

Permalink
Merge pull request #6358 from chartypes/main
Browse files Browse the repository at this point in the history
Reto #16 - Python
  • Loading branch information
Roswell468 authored Feb 24, 2024
2 parents 027d216 + cd40e34 commit 880f248
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Retos/Reto #16 - LA ESCALERA [Media]/python/chartypes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'''
/*
* Crea una función que dibuje una escalera según su número de escalones.
* - Si el número es positivo, será ascendente de izquiera a derecha.
* - Si el número es negativo, será descendente de izquiera a derecha.
* - Si el número es cero, se dibujarán dos guiones bajos (__).
*
* Ejemplo: 4
* _
* _|
* _|
* _|
* _|
*
*/
'''

def built_stairway(number:int) -> None:
up:str = '_|'
down:str = '|_'
first_line:str= (' '*( number+2 ) )+ '_'

if number== 0:
print('__')
else:
print(first_line)
for i in range(abs(number)):
sttairway = ( ' '*(number-i) )+ up if number>0 else ( ' '* i ) + down
print(sttairway)


built_stairway(4)

0 comments on commit 880f248

Please sign in to comment.