A calculation within Bank of America Mobile Banking needs to evaluate factorial values for small nonnegative integers. Write a function that returns the factorial of n, written as n! = n × (n - 1) × ... × 1.
Use an iterative approach and do not call Python's built-in factorial function.
Implement factorial(n), where n is an integer. Return an integer equal to the product of every integer from 1 through n. By definition, 0! equals 1.
def factorial(n):