1 要yuanhao的首字母大写  
li = [1,2,5,'taibai','yuanhao',[1,'alex',3,],True]
li[4] = 'Yuanhao'
print(li)

li[4] = 'yuanhao'upper()
print(li)

2 把wang 后边加个yan,并打印出来
li = [ 1,3,4 ,'wang','True',33,'yy']
s1 = li[3].replace('','yan')
s1 = li[3]
li[3] = li[3][0:4] + 'yan'
print(li)

3 把wang 大写
li = [ 1,3,4 ,'wang','True',33,'yy']
li[3] = li[3].upper()
print(li)
[1, 3, 4, 'WANG', 'True', 33, 'yy']

4 列表正常排序注意格式 和前面一样

li = ['1','3','7','5','2','6']
li.sort()
print(li)

['1', '2', '3', '5', '6', '7']

5倒序(反序).sort(reverse = False) 正常排序 (rerverse = True)倒序, 有区别于reverse 反转
li = ['1','3','7','5','2','6']
li.reverse()
print(li)
['6', '2', '5', '7', '3', '1']


li = ['1','3','7','5','2','6']
li.sort(reverse=True)
print(li)
['7', '6', '5', '3', '2', '1']



51,元祖tupe()
li = ('1','3',['ddd','qwqw',1212],'7','5','2','6')
只能查看不能修改
[ddd] 能修改
print(li[4]) '5'

6 range用法 范围 相当于迭代对象,又步长,
for i in range (1,10):
print(i)

1
2
3
4
5
6
7
8
9

for i in range (1,10,2):
print(i)

1
3
5
7
9

li = ['1','3','7',[ 11,33,44,55,], 2 ,'6']
for i in range (0,len(li)):
if i == 3 :
for k in (li[3]):
print(k)
else:
print(li[i])


注意 len是长度 是个数字
方法一
li = [1,3,4,'alex',[3,7,8,'taibai'],5,2]
for i in li :
if type(i) == list :
for a in i:
print(a)
else:
print(i)

方法2
for i in range (0 ,len(li)):
if i == 4:
for a in li[i] :
print(a)
else :
print(li[i])
打印100 到1 的用法:

for i in range (100,0,-1)
  print(i)