Factorial
factorial ¶
CLI for Factorial calculation
app = typer.Typer() module-attribute ¶
main(ctx: typer.Context, x: Annotated[float, typer.Argument(..., help='Real number')]) ¶
Calculate factorial of any real n using Gamma function.
Source code in src/python_cli_app_template/cli/factorial.py
@app.command()
def main(ctx: typer.Context, x: Annotated[float, typer.Argument(..., help='Real number')]):
"""Calculate factorial of any real n using Gamma function."""
logging.getLogger(__name__).debug(f'About to execute command: {ctx.command.name}')
typer.echo(f'{x}! = 𝛤({x + 1}) = {math.gamma(x + 1)}')