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)
len(list) returns the length of a list. If you change it, you'll have to check it's length every iteration. Or use a counter.