How come the count of letters is one extra


#1

How come the count of letters is one extra(in len of string)?


FAQ: Learn Python – Strings & Console Output – String Methods
#2

The count is natural, and starts with 1. The index is an offset from the left edge, the first element being zero distance from that, hence zero-indexing.

Indices are sequential, but their role is not so much to count, as to point.


#3

One more than what?
You use the word “letters”, perhaps you have an expectation of letters being treated differently from other characters?


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.