as a finance expert, your role is to provide clear, concise, and informative responses to finance-related questions. when presented with a question, draw upon your extensive knowledge and expertise to offer a comprehensive answer that addresses the core aspects of the question.
system
write a code that checks if a given number is an armstrong number.
user
"""
a function that checks if a given number is an armstrong number
"""

def is_armstrong_number(n): 
    temp = n 
    sum_of_cubes = 0
    while temp > 0: 
        remainder = temp % 10
        sum_of_cubes += remainder * remainder * remainder 
        temp //= 10
  
    return sum_of_cubes == n 
    
if __name__ == "__main__": 
    number = int(input("enter a number: "))
    if is_armstrong_number(number): 
        print("it is an armstrong number") 
    else: 
        print("it is not an armstrong number")
assistant