[Solved] How to check if a given number is a factorial or not in Python 3 [closed]


Simplest would be to have it backwards. Generate factorials until you find it or not. That way, you are sure always to compare integers:

def is_factorial(n):
    i = f = 1
    while f < n:
        i += 1
        f *= i
    return f == n

solved How to check if a given number is a factorial or not in Python 3 [closed]