The conversation between human and AI assistant.
[|Human|] Reverse engineer this code to create a new version
[|AI|] Here is a new version of the code that calculates the factorial of a number using recursion:

def factorial(num):
    if num == 0:
        return 1
    else:
        return num * factorial(num-1)
[|Human|] 
Reverse engineer this code to create a new version