[Tutor] Fwd: Re: HELP PLEASE

Alan Gauld alan.gauld at yahoo.co.uk
Mon Aug 12 20:25:27 EDT 2019


On 12/08/2019 19:35, Alan Gauld via Tutor wrote:

> To save some typing convert the?? int conversion loop into a function:
> 
> 
> def?? to_ints(strings):
> ?????? num_copy = []
> ?????? for num in nums:
> ???????????????? num_copy.append(float(num))
> 
> ?????? return num_copy
#

No idea where all the ? came from, however I made a bad error
in that code...

It should read:

def to_ints(strings):
    num_copy = []
    for num in strings:   # strings not nums!
        num_copy.append(float(num))
    return num_copy

Apologies.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list