# 创建列表 friends_list
friends_list = ['Niu Ke Le', 'Niumei', 'Niuneng', 'GOLO']
# 请写一个replace函数,第一个参数是列表friends_list,第二个参数是要替换的数字index,即在函数中将列表元素修改成成列表下标值。
def replace(list, index):
list[index] = index
# 使用print函数直接打印修改前的列表
print(friends_list)
# 使用for循环遍历列表 friends_list,每次调用replace函数替换列表中相应下标的元素
for index in range(len(friends_list)):
replace(friends_list, index)
# 使用print函数直接打印修改后的列表,查看是否替换成功
print(friends_list)