[Solved] AttributeError: ‘NoneType‘ object has no attribute ‘append‘

Problem: in Python, when adding an element to a list, an error is reported attributeerror: ‘nonetype’ object has no attribute ‘append’
my code at that time was:

loss=[]
loss=loss.append(0.1)

Solution: change the code to the below

oss=[]
loss.append(0.1)

The append in the list can directly update the list of added elements without assignment

Read More: