题解 | #字符串变形#

字符串变形

https://www.nowcoder.com/practice/c3120c1c1bc44ad986259c0cf0f0b80e

class Solution:
    def trans(self , s: str, n: int) -> str:
        # write code here
        s_list = s.split(" ")[::-1]
        ans_list = []
        for word in s_list:
            new = ""
            for ch in word:
                if ord("a") <= ord(ch) <= ord("z"):
                    new = new + ch.upper()
                else:
                    new = new + ch.lower()
            ans_list.append(new)
        return " ".join(ans_list)


全部评论

相关推荐

点赞 评论 收藏
分享
牛客83700679...:简历抄别人的,然后再投,有反馈就是简历不行,没反馈就是学历不行,多投多改只要技术不差机会总会有的
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务