L-1008

编写程序,用户输入一个字符串,将其中小写字母全部转换成大写字母,把大写字母全部转换成小写字母,其他字符不变输出。‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‪‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬

注:string.ascii_lowercase 可用于返回所有小写字母,string.ascii_uppercase 可用于返回所有大写字母

import string
str1 = input()
for i in str1:
    if i in string.ascii_lowercase:
        print(i.upper(),end="")
    elif i in string.ascii_uppercase:
        print(i.lower(),end="")
    else:
        print(i,end="")

 

分类:

技术点:

相关文章:

  • 2021-11-23
  • 2022-02-21
  • 2021-09-24
  • 2021-06-14
  • 2021-09-01
  • 2021-11-07
  • 2021-12-16
  • 2021-10-18
猜你喜欢
  • 2022-12-23
  • 2021-12-09
  • 2021-11-05
  • 2022-12-23
相关资源
相似解决方案