[Tutor] A Dictionary question

Andre Engels andreengels at gmail.com
Mon Apr 11 13:30:11 CEST 2011


On Mon, Apr 11, 2011 at 1:01 PM, Sophie DeNofrio <swimbabe339 at yahoo.com>wrote:

> Hi Everyone,
>
> I am a super beginner and am little muddled right now. So I apologize for
> the low level question but I am trying to write a function that will return
> a dictionary of a given list of strings containing two coordinates separated
> by a space with the first numbers as a key and the second numbers as its
> corresponding value. I thought maybe a set might be helpful but that didn't
> seem to work at all. I am pretty much as confused as they come and any help
> would be very much appreciated. Thank you so much for your time.
>

def createDictionary(data):
    result = {}
    for datapiece in data:
        # Code here to make coordinate1 and coordinate2 the values you want
        # Leaving that part to you, but feel free to ask again if you fail
        result[coordinate1] = coordinate2
    return result


-- 
André Engels, andreengels at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110411/3ead63e9/attachment.html>


More information about the Tutor mailing list