Listing 08-03: Factorial calculation

##############################################################################
# Python From Scratch
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2024
# Site: https://pythonfromscratch.com
#
# File: listing\chapter 08\08.03 - Factorial calculation.py
# Description: Factorial calculation
##############################################################################

def factorial(n):
    fat = 1
    while n > 1:
        fat *= n
        n -= 1
    return fat
Click here to download the file