Skip to content

Instantly share code, notes, and snippets.

@DiracSpace
Created May 6, 2021 07:06
Show Gist options
  • Save DiracSpace/ab8a143f3ad2566305af811a82e71cd2 to your computer and use it in GitHub Desktop.
Save DiracSpace/ab8a143f3ad2566305af811a82e71cd2 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
"""
Programa de Python para imprimir los números de secuencia de una operación factorial.
Ingrese su número: 5
120!=5x4x3x2x1
"""
lista = []
def factorial(n: int):
lista.append(n)
return n * factorial(n - 1) if n > 1 else n
def construct_print(n: int, lista: list):
pretty_print = f"{lista[0]}"
for number in lista[1::]:
pretty_print += f"x{number}"
print (f"{n}!={pretty_print}")
n = int(input("Ingrese su número: "))
construct_print(factorial(n), lista)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment