# 011
# 打印所有的“水仙花数”:一个三位数,其各个数字立方和等于该数本身。
for i in range(100,1000):
a = i % 10
temp = int(i / 10)
b = temp % 10
c = int(temp / 10)
if a**3+b**3+c**3==i: # ** 2个连续的星号就是次方
print(i,end=" ")
python demo_水仙花数字
最新推荐文章于 2023-09-14 10:24:00 发布