PAT (Basic Level) Practice Python解法 1009 说反话(list/reverse/join)
hys2 = input().split()
#print(hys2.reverse())这样输出是空值,要reverse操作之后再输出hys2
hys2.reverse()
print(" ".join(hys2))
"这篇博客介绍了如何使用Python的内置方法`split()`、`reverse()`和`join()`来实现字符串的反转操作。通过示例代码`hys2=input().split()`接收用户输入并分割字符串,然后使用`reverse()`翻转列表元素顺序,最后用`"".join(hys2)`将翻转后的列表元素连接成新的字符串。这种方法展示了Python处理字符串的基本技巧。"
PAT (Basic Level) Practice Python解法 1009 说反话(list/reverse/join)
hys2 = input().split()
#print(hys2.reverse())这样输出是空值,要reverse操作之后再输出hys2
hys2.reverse()
print(" ".join(hys2))
3321
7万+
231

被折叠的 条评论
为什么被折叠?
&spm=1001.2101.3001.5002&articleId=118643003&d=1&t=3&u=f2c3a655d1da49a999941ea75e175022)