6.
s='python的创始人是Guido' In [9]: print(s[11:]) Guido In [6]: print(s[-1:-6:-1]) odiuG
7.
In [11]: s1='你' In [12]: s2='最帅' In [13]: print(s1+s2) 你最帅 In [15]: print('{},{}'.format(s1,s2)) 你,最帅 In [16]: print('{}{}'.format(s1,s2)) 你最帅 In [17]: print(s1+s2*3) 你最帅最帅最帅 In [18]: print('{}{}{}{}'.format(s1,s2,s2,s2)) 你最帅最帅最帅
2.
s=str(input('请输入一个字符串:')) 11 b=0 12 a=0 13 for i in s: 14 if 'a' <= i <='z' or 'A'<= i <='Z': 15 a+=1 16 elif '0'<= i and i<='9': 17 b+=1 18 19 20 21 print('字母个数为%d'%a) 22 print('数字个数为%d'%b) 其余不会