# List function beginner append

Hey guys!Please,tell me,how could I fix the function ,so not to have None in output?
Create a function called `append_size` that has one parameter named `lst` .
The function should append the size of `lst` (inclusive) to the end of `lst` . The function should then return this new list.
For example, if `lst` was `[23, 42, 108]` , the function should return `[23, 42, 108, 3]` because the size of `lst` was originally `3` .

``````def append_size(lst):
lst1=[]
for i in lst1:
lst1.append(len(lst))
return lst1
print(append_size([23, 42, 108]))
``````

try looking at it with this tool:
http://www.pythontutor.com/

you are using a loop over `lst1`, which is empty, so no loop, and then the return statement is inside the loop

The function is supposed to append the size of lst to the end of itself. I would do that first and then just return lst. There is no reason to have a for loop.

You have copied over an assignment, but you havenâ€™t talked about your solution. What do you need help with? What have you tried? What is behaving differently than you expect it to?

append the value with the type of variable.

I am hiding your solution, it is pretty rude and unhelpful to give the solution to someone asking for help

1 Like

sorry i thought he wanted the solution.

Letâ€™s take a look to your code. Your function receives as parameter a list which will be append to lst1, which is an empty list. Then, you start a loop over lst1, which is an empty list, for that reason the loop will never be performed. After that, you have: lst1.append(len(lst)), what you are telling here is that the len of the list â€ślstâ€ť will be append to lst1, this is, if you have 10 numbers in â€ślstâ€ť, then the number 10 will be added to lst1, not the numbers in lst but the amount of items in it, so you just need to remove len(). After that, you have a return, when you return something you â€śkillâ€ť the other processes, this is, the loop will stop on the 1st iteration, so you must change the return with a print or display, and finally, you can remove the print on the final line of code or as an output youâ€™ll have lst1 + None.

I hope this helps.