1. 程式人生 > >Python小代碼_9_求水仙花數

Python小代碼_9_求水仙花數

pos == body post end for print color 代碼

for i in range(100, 1000):
    ge = i % 10
    shi = i // 10 % 10
    bai = i // 100
    if ge ** 3 + shi ** 3 + bai ** 3 == i:
        print(i, end= )

#輸出結果
#153 370 371 407 

Python小代碼_9_求水仙花數