I want to assign the value to a list in a function
a = []
def bar(a):
b = [1,2,3]
a = b[1:]
return
bar(a)
print(a)
But I fount a is still an empty list, The only way I can think of is to declare a global list
a = []
def bar():
global a
b = [1,2,3]
a = b[1:]
return
bar()
print(a)
Is there a better way to do this without returning anything.