Using two lists as two arguments in a function


#1

Not sure whats going on here it works fine and I tested it with multiple lists they all work but I still get error code

https://www.codecademy.com/en/courses/python-beginner-nzzVa/4/1
Oops, try again.
join_lists([1, 2], [3, 4]) returned [1, 2, 3, 4, 5, 6, 7, 8] instead of [1, 2, 3, 4]

CODE:

m = [1, 2, 3, 4]
n = [5, 6, 7, 8]

def join_lists(x, y): # Add your code here!
    x = m[0: ]
    y = n[0: ]
    return x + y
print join_lists(m, n)
# You want this to print [1, 2, 3, 4, 5, 6]

Anyone?


#2

Hi @cyberzyme ,

What is the purpose of these two lines?

x = m[0: ]
y = n[0: ]

Before those lines are executed, the parameters x and y serve as references to the two lists that you need to join. But then those two lines overwrite those references.


#3

so are you saying all i need do is delete them?


#4

the purpose as I saw it was to reference the range in the lists