Does len(list) calculate the length of the list every time it is called, or does it return the value of the built-in counter? I have a context where I need to c
len(list) returns the length of the list. Everytime you call it, it will return the length of the list as it currently is. You could set up a counter by taking the len of list initially and then adding 1 to the variable each time something is appended to the list.