Python13 期字符串大考核!!!

本贴最后更新于 1349 天前,其中的信息可能已经时移世异

请用自己目前所学实现字符串大写转小写,小写变大写,并且将字符串变为镜像字符串。例如:’A’变为’Z’,’b’变为’y
示范字符串:
”sdSdsfdAdsdsdfsfdsdASDSDFDSFa”字符串大写变小写 小写变大写,然后最后变为镜像字符串。

Python13期 前来报道!!!

107 回帖
请输入回帖内容 ...
  • xiaosaihua

    image.png

  • rabbit

    image.png

  • ying_1990

    image.png

  • qq5942527

    image.png

  • sunshine

    image.png

  • dennis

    image.png

  • lynne_yuan1314

    image.png

  • Amy13

    image.png

  • lm-py-13

    image.png

  • lili

    image.png

  • huagnjingjing0309

    image.png

  • eason

    a = 'sdSdsfdAdsdsdfsfdsdASDSDFDSFa'

    b=a.swapcase()

    print(a.swapcase())

    first=''
    for i in a:
    if i.islower():
    first = first + i.upper()
    else:
    first = first + i.lower()

    last=''
    for i in a:
    if i.islower():
    last=last+chr(219 - ord(i))
    else:
    last = last + chr(155 - ord(i))
    print (first)
    print(last)

  • eason

    image.png

  • Amy13

    才发现之前粗心写错了,该打该打!
    image.png

  • huahua

    😍 哈哈

  • lee_

    image.png

  • yeah

    image.png
    image.png

请输入回帖内容 ...