n=input(" Enter a number ")
my_sum=0
for i in range(0,len(n)):
my_sum=my_sum+pow(int(n[i]),3)
print("Sum of cube of digits : ",my_sum)
if(my_sum==int(n)):
print("Digits are matching to cube : ", n)
else:
print("Digits are NOT matching to cube : ", n)
Output
Enter a number 371
Sum of cube of digits : 371
Digits are matching to cube : 371
Find the smallest and largest such numbers.
my_list=[]
for n in range(10,100000): # increase this range
my_sum=0
my_str=str(n)
k=len(my_str)
for i in range(0,k):
my_sum=my_sum+pow(int(my_str[i]),3)
if(my_sum==int(n)):
print("This is a matching number: ",n)
my_list.append(n)
print("Highest number : ",max(my_list))
print("Lowest number : ",min(my_list))
Output
This is an matching number: 153
This is an matching number: 370
This is an matching number: 371
This is an matching number: 407
Highest number : 407
Lowest number : 153
All Sample codes
Strong Number Armstrong Number

Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.