CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
jackfrued

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: jackfrued/Python-100-Days
Path: blob/master/Day01-15/code/Day05/lily.py
Views: 729
1
"""
2
找出100~999之间的所有水仙花数
3
水仙花数是各位立方和等于这个数本身的数
4
如: 153 = 1**3 + 5**3 + 3**3
5
6
Version: 0.1
7
Author: 骆昊
8
Date: 2018-03-02
9
"""
10
11
for num in range(100, 1000):
12
low = num % 10
13
mid = num // 10 % 10
14
high = num // 100
15
if num == low ** 3 + mid ** 3 + high ** 3:
16
print(num)
17
18