`for i in range(n+1): a=1 a=a*(i+1) ` With the above method, factorial can be calculated. With this method, it is easier to understand the algorithm