关于函数修改列表的相关问题
代码如下:# -*-coding:gb2312 -*-
def show_magicians(magicians):
print("\nthe magicians are:")
for magician in magicians:
mag = magician.title()
print(mag)
def make_great(magicians):
for magician in magicians:
magician = "The great" + magician.title()
print(magician)
magicians=['arthur','may','leo']
copy = magicians[:]
show_magicians(magicians)
make_great(copy)
print(copy)
按照我的理解,当调用了make_great()函数后,copy列表应该已经修改了,但是为什么打印出的结果,copy列表还是['arthur','may','leo']?
新人,求大神指教!!!!