Created
May 6, 2021 07:06
-
-
Save DiracSpace/ab8a143f3ad2566305af811a82e71cd2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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