Modifying a list in python by passing it to a function

后端 未结 3 1035
心在旅途
心在旅途 2021-01-22 03:21

I have the following python code:

def make_great(l):
    l = [\'The great \' + magician for magician in l]

magicians = [\'Tom\']
make_great(magicians)
print(mag         


        
3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-22 03:47

    Your function is not returning anything. You can either have your print statement in the function or return the modified list and then print it

提交回复
热议问题