Generate a python code to calculate the factorial for a given number.
num = 5
def factorial(number):
    if number == 0:
        return 1
    else:
        return number * factorial(number -1)

factorial(num)