human: 使用递归重写以下代码。输入：
def factorial(n):
    result = 1
    for i in range(1, n + 1):
        result *= i
    return result
 bot: def factorial(n):
    result = 1
    i = 1
    while i <= n:
        result *= i
        i += 1
    return result