1 #求100到999之间的水仙花数 2 num = 0; 3 for item in range(100, 1000): 4 ge = item % 10 5 shi = item // 10 % 10 6 bai = item // 100 7 # print(bai, shi, ge) 8 if ge ** 3 + shi ** 3 + bai ** 3 == item: 9 print(item) 10 num += 1 11 print('100到999的水仙花数有', num, '个')