Problem in python | Sololearn: Learn to code for FREE!

0

Problem in python

Why is the list name shown as none after appending an element. What does that that "None" mean? I am new to programming and I have just started with python. Please ignore any silly mistakes by me. https://code.sololearn.com/c89McJc8Up4f/?ref=app

10/19/2020 3:42:48 PM

<k>Kartik</k>

6 Answers

New Answer

+2

You have to declare firstly your added_state variable as empty list.then assign to it state list .Or you have to remove assignment and append directly to state list with no need to added_state variable

+1

You might find a good explanation here. https://stackoverflow.com/questions/16641119/why-does-append-always-return-none-in-python

+1

Thanks Avinesh & HBhZ_C

+1

HBhZ_C thanx once again.

0

HBhZ_C can u plz tell me how will I declare my variable empty

0

You will declare an empty list .Here you declare added_state = [] with no value.Then you can append to it.