Write a program to calculate the factorial of a number.
Implement def factorial(n):, which accepts a non-negative integer n and returns n!, where n! = n × (n - 1) × ... × 1. By definition, 0! equals 1. Return the result as an integer.
Constraints: 0 <= n <= 20.
def factorial(n):