17/18 using two lists as two arguments in a function, Bug!


#1



I think this is a bug with Codecademy on this part.


https://www.codecademy.com/en/courses/python-beginner-nzzVa/4/1?curriculum_id=4f89dab3d788890003000096#


if I leave it as is, with m = [1, 2, 3] and n = [4, 5, 6]I get:
Oops, try again. join_lists([1, 2], [3, 4]) returned [1, 2, 3, 4, 5, 6] instead of [1, 2, 3, 4]

if I make m= [1,2] and n= [3,4] I get:
Oops, try again. join_lists(['a', 'b'], ['c', 'd']) returned [1, 2, 3, 4] instead of ['a', 'b', 'c', 'd']

The result should be right the first time. It prints out [1, 2, 3, 4, 5, 6]. And If I correct for the error, The error changes. If I make it print ['a', 'b', 'c', 'd'] it says it should be 123456 again.


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

# Add your code here!
def join_lists(x,y):
    combined = m + n
    return combined



print join_lists(m, n)
# You want this to print [1, 2, 3, 4, 5, 6]


#2

lets see what happens when we add a second function call:

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

# Add your code here!
def join_lists(x,y):
    combined = m + n
    return combined



print join_lists(m, n)
print join_lists(['a', 'b'], ['c', 'd'])

it doesn't work. Function which only works for a single list takes away the purpose of functions


#3

@stetim94 Thank you!
So, as you probably saw, I was combining m and n in the function, not x and y.. duh!


#4