# 1.倒序遍历字符串”helloworld”。 # 2.请将s = 'aAsmr3idd4bgs7Dlsf9eAF',字符串的数字取出,并输出成一个新的字符串 结果:3479 # 3.定义字符串line='I am a beautiful girl',变化为:girl beautiful a am I
#1: str="helloworld"
l=list(str)
l.reverse()
print(' '.join(l))
#2: s='aAsmr3idd4bgs7Dlsf9eAF'
l=list(filter(str.isdigit,s))
print(' '.join(l))
#3: def reverse_sentence(sentence):
words=sentence.split()
words.reverse()
new_str=" ".join(words)
return new_str
line='I am a beautiful girl'
print(reverse_sentence(line))
java版的要吗? 思路一样的 phy