Adding two lists


#1


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

Why can't you just do "print m + n" to print the combination of the two lists?

Instead of this:
m = [1, 2, 3]
n = [4, 5, 6]

def join_lists(x, y):
return x + y
print join_lists(m, n)

Couldn't you do this instead:
m = [1, 2, 3]
n = [4, 5, 6]

print m + n
???


I just tried "print m + n" and it worked. Why does code academy tell you to do all this other complicated nonsense just to add to lists? You don't need to define new functions. I'm confused.


#2

What makes you say that you can't?


#3

I tried it and it DID work. But the instructions say

On line 4, define a function called join_lists that has two arguments, x and y. They will both be lists.
Inside that function, return the result of concatenating x and y together.


#4

Yeah you can do that but that exercise expects you to implement that in a function.
This lessons is trying to introduce you to the concepts of functions and why you need them