#18868: Python


jay1060920909@gmail.com (Jay Chen)

學校 : 桃園市立大成國民中學
編號 : 84276
來源 : [118.168.12.205]
最後登入時間 :
2022-12-17 21:40:06
a040. 阿姆斯壯數 | From: [193.116.234.252] | 發表日期 : 2019-08-10 06:37

n = input('請輸入數字:').split()

all_num = [] #分割後的數字

li = [] #所有數字

num = [] #被匹配的數字


for i in range(int(n[0]),int(n[1])):
li.append(i)
all_num.append(list(str(i)))
for j in range(len(all_num)):
all_num[j] = [int(all_num[j]) for all_num[j] in all_num[j]]


for i in range(len(all_num)):
for j in range(len(all_num[i])):
all_num[i][j] = all_num[i][j]**len(all_num[i])

for i in range(len(li)):
if sum(all_num[i]) == li[i]:
num.append(sum(all_num[i]))

if len(num) == 0:
print('none')
else:
for i in range(len(num)):
print(num[i],end=' ')










 
ZeroJudge Forum