[LUNA] Python question

Michael Hall hallmw at att.net
Tue Oct 18 08:49:19 CDT 2016


Thanks.  I got it working. 

    On Monday, October 17, 2016 10:02 PM, Joshua Krasnow <jmk1 at fastmail.fm> wrote:
 

 1) try running it iPython

2) why is the golf dict global? Why not just golf = {}? Also there's a
typo when writing the dict: s/gofl/golf

On 10/17/2016 09:16 PM, Michael W. Hall wrote:
> Yep. Not really a good example I can find.
>
> On Mon, 2016-10-17 at 21:01 -0500, Chris Brightwell wrote:
>> Did you try googling the error?
>>
>>> On Oct 17, 2016, at 8:47 PM, Michael W. Hall <hallmw at att.net>
>>> wrote:
>>>
>>> Trying to help a friend.  I am getting an error on the following
>>> program.
>>>
>>> global golf{}
>>> name = ""
>>> while name != 1:
>>>    name = input("Golfer's name? ")
>>>    score = input("Golfer's score? ")
>>>    golf[name]=score
>>>
>>> file = open("","w")
>>>
>>> for key in golf:
>>>    file.write(key, gofl[key])
>>>
>>> file.close()
>>>
>>> golf is supposed to be a dictionary, but I am getting an error on
>>> the
>>> first line.
>>>
>>> Any ideas?
>>> _______________________________________________
>>> LUNA mailing list
>>> LUNA at lunagroup.us
>>> http://lunagroup.us/mailman/listinfo/luna
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <http://lunagroup.us/pipermail/luna/attachments/20161017/e793e5c
>> 2/attachment.html>
>> _______________________________________________
>> LUNA mailing list
>> LUNA at lunagroup.us
>> http://lunagroup.us/mailman/listinfo/luna
> _______________________________________________
> LUNA mailing list
> LUNA at lunagroup.us
> http://lunagroup.us/mailman/listinfo/luna


_______________________________________________
LUNA mailing list
LUNA at lunagroup.us
http://lunagroup.us/mailman/listinfo/luna


   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lunagroup.us/pipermail/luna/attachments/20161018/ab705d0e/attachment.html>


More information about the LUNA mailing list