1 string = input('请输入一个字符串:') 2 lists = list(string) 3 print('输入的字符串:', lists) 4 lists.reverse() 5 print('反转后的字符串:', lists) 6 i = 0 7 while i < len(lists): 8 if 'a' <= lists[i] <= 'z': 9 lists[i] = lists[i].upper() 10 elif 'A' <= lists[i] <= 'Z': 11 lists[i] = lists[i].lower() 12 i += 1 13 print('大小写改变的字符串:', lists)