Instructions:
Reverse every other word in a given string, then return it. Don't forget to include the spaces!
def test(s):
rr = []
a = s.split(' ')
for i in a :
# if i 角标为偶数
if a.index(i)%2==0:
#在rr里添加i
rr.append(i)
else:
# else在rr里添加 字符串的倒叙(i[::-1])
rr.append(i[::-1])
print rr
if __name__ == "__main__":
test("do you like this?")
>>>['do','uoy','like','?siht']