Help me in solving DEBUGPYC7 problem

My issue

how to do this

My code

def reverse_and_multiply(n):
    reverse_num = 0
    product = 1

    while n > 0:
        digit = n % 10
        if digit <= 5:
            reverse_num = (reverse_num * 10) + digit
            product *= digit
        n //= 10

    return reverse_num, product


# Test the program with sample inputs
num1 = 123456
reverse1, product1 = reverse_and_multiply(num1)
print("Input:", num1)
print("Reverse:", reverse1)
print("Product:", product1)

num2 = 918735
reverse2, product2 = reverse_and_multiply(num2)
print("Input:", num2)
print("Reverse:", reverse2)
print("Product:", product2)

Learning course: Python with Data structures
Problem Link: Practice Problem in - CodeChef