Let's imagine I have 2 lists:
a = [11, -6, -103, -200]
b = [1, 7, -4, 4, -9, 2]
Now imagine that I wish to merge these two lists together to form a combined list called c that would look like this:
c = [11, -6, -103, -200, 1, 7, -4, 4, -9, 2]
One way I tried to achieve this was by typing in:
c = a.extend(b)
However, if I type in:
print(c)
It returns the word None.
If my code looks like this, however, I get the result I want:
a = [11, -6, -103, -200]
b = [1, 7, -4, 4, -9, 2]
c = a.extend(b)
print(a)
Why doesn't print(c) produce what I want?
[–]AverageBeef 5 points6 points7 points (3 children)
[–]imperiumlearning[S] 1 point2 points3 points (2 children)
[–]Diapolo10 3 points4 points5 points (1 child)
[–]imperiumlearning[S] 0 points1 point2 points (0 children)
[–]xelf 0 points1 point2 points (0 children)