题解 | #简单密码#

简单密码

http://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac

def nie(a):
    dic = {"0":"0","1":"1","abc":"2","def":"3","ghi":"4","jkl":"5","mno":"6","pqrs":"7","tuv":"8","wxyz":"9"}
    for key in dic:
        if key.find(a) != -1:
            return dic[key]
        else:
            continue

def da(b):
    if ord(b)>=65 and ord(b)<90:
        st = chr(ord(b)+32+1)
    else:
        st = 'a'
    return st

if __name__ == '__main__':
    #YUANzhi1987
    st1 = input()
    lst =[]
    for i in st1:
        if ord(i)>= 65 and ord(i) <= 90:
            lst.append(da(i))
        elif (ord(i)>= 97 and ord(i) <= 122) :
            lst.append(nie(i))
        else:
            lst.append(i)
    print(''.join(lst))
全部评论

相关推荐

10-28 11:04
已编辑
美团_后端实习生(实习员工)
一个2人:我说几个点吧,你的实习经历写的让人觉得毫无含金量,你没有挖掘你需求里的 亮点, 让人觉得你不仅打杂还摆烂。然后你的简历太长了🤣你这个实习经历看完,估计没几个人愿意接着看下去, sdk, 索引这种东西单拎出来说太顶真了兄弟,好好优化下简历吧
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务