# Function to check if the number is a Disarium number
def is_disarium(number):
    # Convert the number to string to easily access individual digits
    num_str = str(number)
    sum_of_powers = 0
    
    # Loop through each digit, raising it to the power of its position (index+1)
    for i in range(len(num_str)):
        sum_of_powers += int(num_str[i]) ** (i + 1)
    
    # Check if the sum equals the original number
    return sum_of_powers == number

# Function to get the user input and check for Disarium number
def check_disarium():
    # Get user input
    num = input("Enter a number: ")
    
    # Check if the entered value is a valid integer
    if num.isdigit():
        num = int(num)
        # Check if the number is a Disarium number
        if is_disarium(num):
            print(str(num) + " is a Disarium number.")
        else:
            print(str(num) + " is not a Disarium number.")
    else:
        print("Please enter a valid positive integer.")

# Calling the function to run the program
check_disarium()

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: