for i in range(100,1000):
s=str(i)
a=pow(int(s[0]),3)
b=pow(int(s[1]),3)
c=pow(int(s[2]),3)
if (a+b+c==i):
print(i,end=', ')
#错误输出:
153, 370, 371, 407,
期望输出:
153, 370, 371, 407
如何从错误输出到期望输出?
for i in range(100,1000):
s=str(i)
a=pow(int(s[0]),3)
b=pow(int(s[1]),3)
c=pow(int(s[2]),3)
if (a+b+c==i):
print(i,end=', ')
#错误输出:
153, 370, 371, 407,
期望输出:
153, 370, 371, 407
如何从错误输出到期望输出?
for i in range(100,1000):
s=str(i)
a=pow(int(s[0]),3)
b=pow(int(s[1]),3)
c=pow(int(s[2]),3)
if (a+b+c==i):
print(i,end=',')
print("\b ")