1. name = "aleX leNb "
请输出name变量对应的值中的"e" 所在索引位置
name = "aleX leNb"
index = 0 #手动记录索引
for c in name:
if c == 'e': #如果字母是e
print(index) #打印索引
index = index + 1
2.有字符串s = "123a4b5c"
1)通过对s切片形成新的字符串s1, s1 = "123"
s = "123a4b5c"
print(s[:3])
2)通过对s切片形成新的字符串s2,s2 = "a4b"
s = "123a4b5c"
print(s[3:6])
3)通过对s切片形成新的字符串s3,s3 = "1345"
s = "123a4b5c"
print(s[::2])
4)通过对s切片形成新的字符串s4,s4 = "2ab"
s = "123a4b5c"
print(s[1:6:2])
5)通过对s切片形成新的字符串s5,s5 = "c"