1.
1)
li=['alex','WuSir','ritian','barry','wenzhou']
print(len(li))
2)
li=['alex','WuSir','ritian','barry','wenzhou']
li.append('seven')
print(li)
3)
li=['alex','WuSir','ritian','barry','wenzhou']
li.insert(1,'Tony')
print(li)
4)
li=['alex','WuSir','ritian','barry','wenzhou']
li[2]='Kelly'
print(li)
5)
li=['alex','WuSir','ritian','barry','wenzhou']
li2=[1,'a',3,4,'heart']
li.extend(li2)
print(li)
6)
li=['alex','WuSir','ritian','barry','wenzhou']
li2='qwert'
li.extend(li2)
print(li)
7)
li=['alex','WuSir','ritian','barry','wenzhou']
li.remove('alex')
print(li)
8)
li=['alex','WuSir','ritian','barry','wenzhou']
a=li.pop(2)
print(li)
print(a)
9)
li=['alex','WuSir','ritian','barry','wenzhou']
del li[2:4]
print(li)
10)
li=['alex','WuSir','ritian','barry','wenzhou']
a=[]
li2=li[::-1]
a.extend(li2)
print(a)
11)
li=['alex','WuSir','ritian','barry','wenzhou']
a=li.count('alex')
print(a)
2.
1)
li=[1,3,2,'a',4,'b',5,'c']
l1=li[0:3]
print(l1)
2)
li=[1,3,2,'a',4,'b',5,'c']
l1=li[3:6]
print(l1)
3)
li=[1,3,2,'a',4,'b',5,'c']
l1=li[0::2]
print(l1)
4)
li=[1,3,2,'a',4,'b',5,'c']
l1=li[1:-2:2]
print(l1)
5)
li=[1,3,2,'a',4,'b',5,'c']
l1=li[-1]
print(l1)
6)
li=[1,3,2,'a',4,'b',5,'c']
l1=li[-3:0:-2]
print(l1)
3.
1)
li=[2,3,'k',['qwe',20,['k1',['tt',3,'']],89],'ab','adv']
li[3][2][1][0]='TT'
lis[3][2][1][0] = lis[3][2][1][0].replace("t", "T")
print(li)
2)
li=[2,3,'k',['qwe',20,['k1',['tt',3,'']],89],'ab','adv']
li[3][2][1][1]=100
li[1]=100
li[3][2][1][1] = str(li[3][2][1][1]+97)
print(li)
3)
li=[2,3,'k',['qwe',20,['k1',['tt',3,'']],89],'ab','adv']
li[3][2][1][2]=101
li[3][2][1][1] = str(int(li[3][2][1][2])+100)
print(li)
4.
1)
li=['alex','eric','rain']
li1=''
for i in li:
li1=li1+i+'_'
print(li1[0:-1])
5.
li = ["alex", "WuSir", "ritian", "barry", "wenzhou", ""]
for i in range(0,len(li)):
print(i)
6.
lst=[]
for i in range(0,101):
if i %2 ==0:
lst.append(str(i))
print(lst)
7.
lst=[]
for i in range(0,51):
if i %3 ==0:
lst.append(str(i))
print(lst)
8.
for i in range(100,0,-1):
print(i)
9.
a=[]
b=[]
for i in range(100,9,-1):
if i %2==0:
a.append(i)
for num in a:
if num %4 ==0:
b.append(num)
print(b)
10.
a=[]
b=[]
for i in range(1,31):
a.append(i)
for j in a :
if j %3==0:
j='*'
b.append(j)
print(b)
11.
a=[]
li=['TaiBai,','xC','AbC','egon','TiAn','WuSir','aqc']
for i in li :
i.replace(' ','')
if (i.startswith('a') or i.startswith('A')) and i.endswith('c'):
a.append(i)
print(a)
12.
a=input('输入:')
b=''
c=[]
li=['苍老师','东京热','武藤兰','波多野结衣']
for j in li :
if str(j) in a :
a=a.replace(str(j),('*'*len(j)))
c.append(a)
print(c)
13.
a=[]
for i in li :
if type(i)!=list:
a.append(i)
else:
a.extend(i)
for j in a :
print(j)
14.
d=0
c=[]
while 1 :
a=input('输入:')
if a.lower() !='q':
e=a.split('_')
c.append(a)
d=d+int(e[1])
else:
break
print(d/len(c))