Hello again, just getting back to the computer, real world etc.
I hate to say this, but I never did well in algebra. But I am
determined to slog through this to understand it well.
On Feb 8, 2009, at 7:29 PM, bob gailer wrote:
Please always reply-all so a copy goes to the list. We all
parti
Hi Bob, I missed this in my in box. Sorry.
See below where I have answered your question with yet another.
On Feb 8, 2009, at 11:10 AM, bob gailer wrote:
cclpia...@comcast.net wrote:
HI,
I just realized that I shouldn't enclose my project in an attachment.
This is my first attempt to string t
Please always reply-all so a copy goes to the list. We all participate
and learn.
Would you also respond to my requests for clarified algorithm?
cclpia...@comcast.net wrote:
Hi Bob,
Thanks for your input! I ran the program in IDLE and it worked just
fine. Apparently my calculations were corr
For what its worth - here is my revision of your program. I did not send
it earlier because I kept finding things that led me to want to see and
verify the fundamental algorithm. But now I think my observations could
also be useful.
My changes:
Changed indentation from 8 to 2. For me this is
cclpia...@comcast.net wrote:
HI,
I just realized that I shouldn't enclose my project in an attachment.
This is my first attempt to string together py-code. Is this correct?
And how would a pro word this? It seems like an awful lot of code for
such a small task.
I think we should start with
HI,
I just realized that I shouldn't enclose my project in an attachment.
This is my first attempt to string together py-code. Is this correct?
And how would a pro word this? It seems like an awful lot of code
for such a small task.
Thanks in advance,
Pat
> File "C:\Python24\Account Tracker.py", line 10, in load_file
>amount = line.next().strip()
> AttributeError: 'str' object has no attribute 'next'
>
> According to it, the 'str' object has no attribute 'next'. So how
> would I load my file containing my data?
The str object in question is l
Message -
From: "Alan Gauld" <[EMAIL PROTECTED]>
To: "Nathan Pinno" <[EMAIL PROTECTED]>;
Sent: Sunday, June 25, 2006 1:07 AM
Subject: Re: [Tutor] Is this correct syntax for what I want?
>> File "C:\Python24\Account Tracker.py", line 49, in pri
Thanks, it works now perfectly! Thanks for all the help!
- Original Message -
From: "Alan Gauld" <[EMAIL PROTECTED]>
To: "Nathan Pinno" <[EMAIL PROTECTED]>;
Sent: Sunday, June 25, 2006 1:07 AM
Subject: Re: [Tutor] Is this correct syntax for what I want?
> File "C:\Python24\Account Tracker.py", line 49, in printall
>print account,"\t $",accountlist[account]+"\n"
> TypeError: unsupported operand type(s) for +: 'float' and 'str'
>
> So how do I fix this error?
What it's saying is you can't add a float and string. If you
look at the code you a
: "Nathan Pinno" <[EMAIL PROTECTED]>;
Sent: Saturday, June 24, 2006 3:54 PM
Subject: Re: [Tutor] Is this correct syntax for what I want?
>
>> The data structure is:
>> mydata = [(Checking, 12.50),(Savings, 34.50)] And I want the result to
>> look like this:
&
> The data structure is:
> mydata = [(Checking, 12.50),(Savings, 34.50)]
>
> And I want the result to look like this:
> mydata = [(Checking, 19.50),(Savings, 34.50)]
>
> So how do I do this?
OK, The problem is that you cannot change the contents of a
tuple, you can only create a new tuple. The
> The data is account name and 12.50 (example).
> I want to access the data to add and subtract from it.
> For example
> 12.50 - 2.25 = 10.25
> 10.25 + 4.75 = 15.00
Sorry, I meant the data structures. You mentioned you had a list of
tuples?
And you wanted to perform addition./subtraction on memb
<[EMAIL PROTECTED]>;
Sent: Friday, June 23, 2006 2:48 PM
Subject: Re: [Tutor] Is this correct syntax for what I want?
> Nathan,
>
> Can you show us an example of the data?
> And what you want to do to it, ie before and after values.
>
> Its not clear to me whether you want to
the data to use in an addition/subrtraction storing
the result elsewhere (which is perfectly possible)
Alan G.
- Original Message -
From: "Nathan Pinno" <[EMAIL PROTECTED]>
To:
Sent: Friday, June 23, 2006 2:20 AM
Subject: [Tutor] Is this correct syntax for what I want?
I
You can do:
letterlist[x] += amount
letterlist[x] -= amount
Cheers,
--
murtog_
[ http://murtog.blogspot.com ]
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On Thu, 22 Jun 2006, Nathan Pinno wrote:
> I want to be able to add and subtract from a number in a tuple in a
> list. Is this the correct syntax?
>
> letterlist[x] = letterlist[x] + amount # for addition
>
> letterlist[x] = letterlist[x] - amount # for subtraction
Try it.
I want to be able to add and subtract from a number
in a tuple in a list. Is this the correct syntax?
letterlist[x] = letterlist[x] + amount # for
addition
letterlist[x] = letterlist[x] - amount # for
subtraction
If this is not correct, what is the correct
syntax?
Thanks,
Nathan Pinn
Hoffmann wrote:
> So, I wrote the script below:
>
> class Time:
> pass
>
> hour = int( raw_input('Enter the hour: ') )
> min = int( raw_input('Enter the minute: ') )
> sec = int( raw_input('Enter the sec: ') )
>
> time = Time()
> time.hours = hour
> time.minutes = min
> time.seconds
Hoffmann wrote:
> class Time:
> def __init__(self, hours = 0, minutes = 0, seconds =
> 0):
> self.hours = hours
> self.minutes = minutes
> self.seconds = seconds
>
> def printTime(self): # By convention, the first
> parameter of a metho
>> Personally I prefer to put the initialisation
>> into an __init__() method,
> Thanks for your comments. Please, see below a new
> version of that exercise. What do you think?
> hour = int( raw_input('Enter the hour: ') )
> min = int( raw_input('Enter the minute: ') )
> sec = int( raw_input('
--- Alan Gauld <[EMAIL PROTECTED]> wrote:
> Hi,
>
> > The goal is to write a function printTime that
> takes a
> > Time object as an argument and prints it in the
> form
> > hours:minutes:seconds.
> >
> > So, I wrote the script below:
> >
> > class Time:
> > pass
> >
> > hour = int( raw_input(
Hi,
> The goal is to write a function printTime that takes a
> Time object as an argument and prints it in the form
> hours:minutes:seconds.
>
> So, I wrote the script below:
>
> class Time:
> pass
>
> hour = int( raw_input('Enter the hour: ') )
> min = int( raw_input('Enter the minute: ') )
>
Hello:
This question is regarding the first exercise of the
book "How to think Like a Computer Scientist:
Learning with Python", by Downey, Elkner, and Meyers,
Chapter 13, page 137.
The goal is to write a function printTime that takes a
Time object as an argument and prints it in the form
hours:m
24 matches
Mail list logo