This is because you are shadowing the built-in list
l = [1,2,3]print(type(l) == list) # True
type(list)
gives <class 'list'>
, which is not [1,2,3]
.
You can use one of the options suggested by @ThierryLathuille, but the best practice will be renaming the list
variable, you shouldn't use built-in names as variables names.