#!/usr/bin/python3 # -*- coding: utf-8 -*- """ Factorial. For example, factioral(5) is: 5! = 5 * 4 * 3 * 2 * 1 """ import math print(math.factorial(5)) # %% Recursive def factorial_rec(n: int) -> int: """ Computes n! for positive n integers """ if n == 0: return 1 else: return n * factorial_rec(n - 1) for n in range(1, 11): val = factorial_rec(n) print(n, " factorial is ", val)