Skip to content

Commit

Permalink
Merge pull request #3485 from RubenMkda/main
Browse files Browse the repository at this point in the history
Reto #20 - Python
  • Loading branch information
Roswell468 authored May 18, 2023
2 parents 5ad16ff + 668d549 commit 521fb74
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Retos/Reto #20 - LA TRIFUERZA [Media]/python/RubenMkda.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
def trifuerza(rows):

for n in range(1, rows*2+1):

formule = 2*n-1
formule2 = rows*2
spaces = rows*2-n

# Draw top triangle
if n <= rows:
print(" "*spaces + "*"*(formule))

# Draw bottom triangles
if n > rows:
print(" "*spaces + "*"*( formule - formule2 ), end="")
print(' '*(formule2-n+spaces+1), end='')
print("*"*(formule-formule2))

if __name__ == "__main__":

while True:

rows = input("Por favor ingrese el numero de filas: ")
if rows.isdigit():
rows = int(rows)
print("Trifuerza: ", rows)
trifuerza(rows)
break

else:
print("El numero debe ser un número entero. Intente de nuevo.")

0 comments on commit 521fb74

Please sign in to comment.