题解 | #简单密码#

简单密码

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

python3简单粗暴

def func():
    s = input()
    res = []
    tab = [['0'],['1'],['a','b','c'],['d','e','f'],['g','h','i'],['j','k','l'],['m','n','o'],['p','q','r','s'],['t','u','v'],['w','x','y','z']]
    for i in s:
        if i in tab[2]:            
            res.append('2')
        elif i in tab[3]:
            res.append('3')
        elif i in tab[4]:
            res.append('4')
        elif i in tab[5]:
            res.append('5')
        elif i in tab[6]:
            res.append('6')
        elif i in tab[7]:
            res.append('7')
        elif i in tab[8]:
            res.append('8')
        elif i in tab[9]:
            res.append('9')
        elif ord('A') <= ord(i) < ord('Z'):
            a = chr(ord(i)+1).lower()
            res.append(a)
        elif i == 'Z':
            res.append('a')
        else:
            res.append(i)
    for i in res:
        print(i,end=(''))
    
func()


全部评论

相关推荐

2024-12-30 22:49
长沙理工大学 Java
神哥了不得:没什么可以指导的地方了,简历确实牛,我大号分享过投递策略,广投就行
点赞 评论 收藏
分享
评论
2
1
分享

创作者周榜

更多
牛客网
牛客企业服务