# Print out all the "number of Narcissus", the so-called "Narcissus number" refers to a three-digit number,
# digits of its cube is equal to the number itself. For example: 153 is a "number Narcissus",
# since the cube cubic 1 + 5 = 153 cubic +3.
Method a: first setting one hundred, ten, you are a number of 0 to 9, and then calculated using the method loops to find:
1 for a in range(10): 2 for b in range(10): 3 for c in range(10): 4 n = a * 100 + b * 10 + c 5 if n == a**3+b**3+c**3: 6 if n!=0 and n!=1: 7 print(n)
Method 2: Using taking business and take the remainder of the method. Suppliers take a // b, a% b modulo
1 for i in range(100,1000): 2 a = i//100 3 b = (i%100)//10 4 c = (i%100)%10 5 if a**3 + b**3 + c**3 == i : 6 print(i)