Python cannot count apparently

Peter Pearson pkpearson at nowhere.invalid
Sun Feb 7 17:06:25 EST 2021


On Sun, 7 Feb 2021 20:49:52 +0000 (UTC), Kevin M. Wilson wrote:

> Set i = 0 at the begin of the code, that way each entry starts at
> Logical 0 of the array/container/list...

No.  The original code, as posted, was

>>    I recently coded this snippet of code:
>>    myString=„hello“
>>    for i in range(len(myString):
>>         print(string[i])

Setting i=0 before the "for" statement would make no difference.
In the first pass through the for loop, i is set to the first
value in the range, which is zero.



-- 
To email me, substitute nowhere->runbox, invalid->com.


More information about the Python-list mailing list