浙大版《Python 程序设计》题目集 第3章-14 字符串字母大小写转换 (15分)

s = input()
end = s.index('#')
s_new = s[:end]
li = []
for each in s_new:
    if each.isupper():
        li.append(each.lower())
    elif each.islower():
        li.append(each.upper())
    else:
        li.append(each)
s_final = ''.join(li)
print(s_final)
发布了33 篇原创文章 · 获赞 0 · 访问量 254

猜你喜欢

转载自blog.csdn.net/weixin_42229583/article/details/104589429