Check your code to make sure you don't have lst
somewhere else as lst=[]
.
If you type the following:
lst= [] # more code lst = [1, 2, 3, 4]
You'll receive the prompt you got. You won't run into problems if you keep it that way but it's bad practice.
In those two cases you are using a function to change the variable: list()
and append()
. In the previous one where you're just redefining the variable explicitly.
Another improper example:
a = 7 # some code that has nothing to do with "a" or uses it a = 8
Just set a = 8
to begin with. No need to store a = 7
.