Re: [Tutor] Attribute error message received on Card Game program

2012-02-24 Thread Dave Angel
On 02/24/2012 11:34 AM, bob gailer wrote: On 2/24/2012 11:08 AM, SKHUMBUZO ZIKHALI wrote: Hi /*I am trying to run the following program from Guide to Programming with Python by Micheal Dawson:*/ /**/ class Card(object): RANK = ["A","2","3","4","5","6","7" "8","9","K","Q","J"]

Re: [Tutor] Attribute error message received on Card Game program

2012-02-24 Thread bob gailer
On 2/24/2012 11:08 AM, SKHUMBUZO ZIKHALI wrote: Hi /*I am trying to run the following program from Guide to Programming with Python by Micheal Dawson:*/ /**/ class Card(object): RANK = ["A","2","3","4","5","6","7" "8","9","K","Q","J"] SUIT = ["s","d","h","c"] def __init

[Tutor] Attribute error message received on Card Game program

2012-02-24 Thread SKHUMBUZO ZIKHALI
Hi I am trying to run the following program from Guide to Programming with Python by Micheal Dawson:   class Card(object):     RANK = ["A","2","3","4","5","6","7"     "8","9","K","Q","J"]     SUIT = ["s","d","h","c"]     def __init__(self,rank, suit):     self.rank = rank    

Re: [Tutor] attribute error - quick addition

2007-07-30 Thread Eric Brunson
Sara Johnson wrote: > No luck finding tutors. I don't make enough. Sara, Alan didn't say to find a tutor, he suggested you read a tutorial. You seem to be having problems with very basic python concepts and his suggestion was to take an hour or two and *read* some gentle introductions that w

Re: [Tutor] attribute error - quick addition

2007-07-30 Thread Sara Johnson
: Alan Gauld <[EMAIL PROTECTED]> To: tutor@python.org Sent: Monday, July 30, 2007 5:55:56 PM Subject: Re: [Tutor] attribute error - quick addition "Sara Johnson" <[EMAIL PROTECTED]> wrote > Sorry... I'm still learning about lists, tuples, etc... Sarah, You've bee

Re: [Tutor] attribute error - quick addition

2007-07-30 Thread Alan Gauld
"Sara Johnson" <[EMAIL PROTECTED]> wrote > Sorry... I'm still learning about lists, tuples, etc... Sarah, You've been hanging around with this list for a few weeks now. If you just took one day out to go through the official tutorial then you should know enough to answer all of these questions

Re: [Tutor] attribute error - quick addition

2007-07-30 Thread Sara Johnson
Sorry... I'm still learning about lists, tuples, etc... Thanks, Sara - Original Message From: Tiger12506 <[EMAIL PROTECTED]> To: tutor@python.org Sent: Monday, July 30, 2007 5:42:47 PM Subject: Re: [Tutor] attribute error - quick addition > Thanks Alan and Kent (f

Re: [Tutor] attribute error - quick addition

2007-07-30 Thread Tiger12506
> Thanks Alan and Kent (for the sorting notes)! > > Alan...I guess I thought outfile2 had data. { i.e., > outfile2=open('missmeas.dat','w') } Argghh!!! No, no, no! Attribute Error! No matter how much data you have in the file, you will *never* be able to call sort on it, because file objects d

Re: [Tutor] attribute error - quick addition

2007-07-30 Thread Sara Johnson
, July 29, 2007 7:00:12 PM Subject: Re: [Tutor] attribute error - quick addition "Sara Johnson" <[EMAIL PROTECTED]> wrote > Sorry...I forgot a few more lines at the end of the code. Starts > with "outfile2write..." > I also added outfile2.sort() OK, at leasrt we

Re: [Tutor] attribute error - quick addition

2007-07-29 Thread Alan Gauld
"Sara Johnson" <[EMAIL PROTECTED]> wrote > Sorry...I forgot a few more lines at the end of the code. Starts > with "outfile2write..." > I also added outfile2.sort() OK, at leasrt we see where the error occcurs. The problem emains that you are trying to sort a file which doesn't have a sort me

Re: [Tutor] attribute error

2007-07-29 Thread Alan Gauld
"Sara Johnson" <[EMAIL PROTECTED]> wrote > I always thought with floats you needed a 0.0. > I do have some percentages that are less than 1% but more than 0.0. If you already have a float value then you can compare it to an int and save the typing. zero means the same in a float comparison as

Re: [Tutor] attribute error

2007-07-29 Thread Alan Gauld
"Sara Johnson" <[EMAIL PROTECTED]> wrote Is this the correct traceback? Output okay except it will not sort alphabetically. Traceback (most recent call last): File "./mymods.py", line 83, in ? outfile2.sort() AttributeError: 'file' object has no attribute 'sort' *

Re: [Tutor] attribute error - quick addition

2007-07-29 Thread Sara Johnson
%s has %4.1f%% missing" % (key,100*fracmiss) if fracmiss>0.: print outstring outfile2.write(outstring+'\n') #notice explicit newline \n outfile2.sort() outfile2.close() - Original Message ---- From: Alan Gauld <[EMAIL PROTECTED]> To: tut

Re: [Tutor] attribute error

2007-07-29 Thread Sara Johnson
- From: Alan Gauld <[EMAIL PROTECTED]> To: tutor@python.org Sent: Sunday, July 29, 2007 2:23:55 AM Subject: Re: [Tutor] attribute error "Sara Johnson" <[EMAIL PROTECTED]> wrote > However, is there an indentation error here? Not that I can see. Is there an error? If so ca

Re: [Tutor] attribute error

2007-07-29 Thread Sara Johnson
- Original Message From: Alan Gauld [EMAIL PROTECTED] >> for key in skeys: >> fracmiss=1.*numberMissing(z[key].values())/nsites #note decimal >> multiplication, 1.* >This is a mess. Why have that long comment when all that's needed >is to add the zero?! (and some spaces to make

Re: [Tutor] attribute error

2007-07-29 Thread Alan Gauld
"Sara Johnson" <[EMAIL PROTECTED]> wrote > However, is there an indentation error here? Not that I can see. Is there an error? If so can you send the traceback? Its very hard to answer questions without any context. > I may just be too frustrated to see it. > > for key in skeys: > fracm

Re: [Tutor] attribute error --Disregard

2007-07-28 Thread Sara Johnson
Disregard this post. Sorry for the added message in everyone's inbox. - Original Message From: Sara Johnson <[EMAIL PROTECTED]> To: Python Sent: Saturday, July 28, 2007 11:19:15 PM Subject: Re: [Tutor] attribute error I scrapped that other attempt. I keep hitting

Re: [Tutor] attribute error

2007-07-28 Thread Sara Johnson
%4.1f%% missing" % (key,100*fracmiss) if fracmiss>0.: print outstring - Original Message From: Bob Gailer <[EMAIL PROTECTED]> To: Sara Johnson <[EMAIL PROTECTED]> Cc: Python Sent: Saturday, July 28, 2007 10:14:58 PM Subject: Re: [Tutor] attribute e

Re: [Tutor] attribute error

2007-07-28 Thread Bob Gailer
Sara Johnson wrote: > I thought 'sort()' was a function you could use as long as the dict or > key had some value. When is this not right? Please give us some context for the question. Code fragment, traceback. sort is a method of mutable sequence types (lists, ...) myList = [1, 3, 2] myList.so

[Tutor] attribute error

2007-07-28 Thread Sara Johnson
I thought 'sort()' was a function you could use as long as the dict or key had some value. When is this not right? Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo!