#try to avoid input function n = int(input("Enter any Number :")) for i in range(1,n+1): sumb = 0 c = len(str(i)) for j in str(i): sumb = sumb+(int(j)**c) if sumb == i: print(i)
Click the run button. Try to avoid input() function.