1. Problem
2. Procedure
def daf(numb1):
if numb1 >= 100:
pass
else:
print('请输入一个大于100的正整数')
numb2 = str(numb1)
lenargs = len(numb2)
sum = 0
for i in range(lenargs):
sum = sum + int(numb2[i])**3
#print(sum)
if sum == numb1:
print('%s是水仙花数' % numb1)
#else:
# print('%s不是水仙花数' % numb1)
nummax = 1000
for i in range(100,nummax+1):
daf(i)
3. Note:
Here, the input number is converted into a string format, and each unknown number is directly queried to identify the size of a tens of thousands of digits.