First of all do not use list as a variable, use lst. Also you are incrementing a value not appending to a list in your original code. To create the list, then use lst.append(). You also need to return the list
def squarenumber():
num = raw_input('Enter numbers, eg 1,2,3: ').split(',')
print [int(n) for n in num if n.isdigit()] ##display user input
lst = []
for n in num:
if n.isdigit():
nn = int(n)
lst.append(nn*nn)
print lst
return lst
x = squarenumber()