Spy number

A number is known as a spy number if the sum of its digits is exactly equal to the product of its digits.

Check Spy Number

def checkSpy(number):
    sum, mul = 0, 1

    while number > 0:
        rem = number % 10
        sum += rem
        mul *= rem
        number = int(number / 10)

    if sum == mul:
        return True
    else:
        return False


number = int(input("Enter a number to check for spy number: "))

if checkSpy(number) == True:
    print(str(number) + " is a spy number")
else:
    print(str(number) + " is not a spy number")
Output
Enter a number to check for spy number: 123
123 is a spy number

Spy Number List (1-n)

def checkSpy(number):
    sum, mul = 0, 1

    while number > 0:
        rem = number % 10
        sum += rem
        mul *= rem
        number = int(number / 10)

    if sum == mul:
        return True
    else:
        return False


max = int(input("Enter the upper bound to find spy numbers: "))

print("Spy numbers: ")
for i in range(1, max):
    if checkSpy(i):
        print(i, end=" ")
Output
Enter the upper bound to find spy numbers: 1500
Spy numbers: 
1 2 3 4 5 6 7 8 9 22 123 132 213 231 312 321 1124 1142 1214 1241 1412 1421