[Tutor] Index Out of Range?List

Alan Gauld alan.gauld at yahoo.co.uk
Thu May 4 13:31:05 EDT 2017

On 04/05/17 13:50, Stephen P. Molnar wrote:
>> I'll assume that's where the problem lies.
>> Try checking if the string is not empty before using it:
>>       for line in f.readlines():
>>           if line:
>>              atm_chg.append(float( line.split()[-1] ))

> I have edited the code:
>      for line in f.readlines():
>          atm_chg.append(float( line.split()[-1] ))

> Execution still generates the errors:

That's because you didn't include the change that
I thought might fix the error. See above.

Alan G
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:

More information about the Tutor mailing list