1. 程式人生 > >數列和+水仙花數+句子翻轉

數列和+水仙花數+句子翻轉

split() span map sflow flow img isf -1 blog

1、數列和

import math
m,n = map(int, raw_input().split())
answer = []
for i in range(n):
    answer.append(m)
    m = math.sqrt(m)
print %.2f % sum(answer)

2、水仙花數

m,n = map(int,raw_input().split())
answer = []
def isFlower(x):
    return x == sum([int(i)**3 for i in str(x)])
for i in range(m,n+1):
    
if isFlower(i): answer.append(str(i)) if len(answer) != 0: print " ".join(answer) else: print no

3、句子反轉

技術分享

import sys
print(" ".join(raw_input().strip().split(" ")[::-1]))

數列和+水仙花數+句子翻轉