Write a Python function to calculate the factorial of a number (a non-negative integer).
def factorial(n):
    if n == 0: 
        return 1 
    return n * factorial(n-1) 

num = 9
factorial_num = factorial(num)
print(factorial_num)