大佬们,这两个有会的吗,帮朋友问的
pycharm吧
全部回复
仅看楼主
level 1
如图3和12
2023年05月14日 13点05分 1
level 1
def is_armstrong(num):
temp = num
sum_armstrong = 0
length = len(str(num))
while temp > 0:
sum_armstrong += (temp%10)**length # 取最后一位数字
temp //= 10
if sum_armstrong == num:
return True
else:
return False
for num in range(1,1000):
if is_armstrong(num):
print(num, end = ' ')[汗]pycharm没人,不如去python吧
2023年05月19日 18点05分 2
1