alternative solution

alternative solution
factorial function

Consider having factorial() call itself. When the input is 1, your
function could just return 1. Otherwise, it could return the number
multiplied by factorial(n - 1).
is_prime

A prime number is a positive integer greater than 1 that has no
positive divisors other than 1 and itself.
A prime number is a positive integer greater than 1 that has no
positive divisors other than 1 and itself.
Remember: all numbers less than 2 are not prime numbers!