I just started out learning python and am playing around with list methods. I bumped into this problem; assigning list.extend to a variable doesn't work the way I thought it would and I'm not sure why.
alph = ["a", "b", "c"]
num = [0, 1, 2,]
num_alph = alph.extend(num)
print num_alph
Printing num_alph results in none but I was expecting it print this; ["a", "b", "c", 0, 1, 2]
Rewriting the code to this gets me the expected result:
alph = ["a", "b", "c"]
num = [0, 1, 2,]
alph.extend(num)
num_alph = alph
print num_alph
Why does my former code print none instead of the extended list?