# 循环输入字符,大写转小写,小写转大写,其它字符不变,然后输出

S = str(input('请输入十个字符串'))
for i in range(len(S)):

    if 97 <= ord(S[i]) <=122 :
        print(chr(ord(S[i])-32),end=' ')
    elif 65 <= ord(S[i]) <= 90:
        print(chr(ord(S[i])+32),end=' ')
    else:
        print(S[i],end=' ')

猜你喜欢

转载自blog.csdn.net/lovel_t/article/details/81142725