> def increment(time, seconds):
> time.seconds = time.seconds + seconds
>
> while time.seconds >= 60:
>time.seconds = time.seconds - 60
>time.minutes = time.minutes + 1
Tale a look at what this loop is doing.
Think about its purpose. If you werre doing this
with paper and pencil would
[snip code]
> *When I run the program using IDLE, I get the following:*
>
> Send the contents of a directory as a MIME message.
>
> Usage: dirmail [options] from to [to ...]*
>
> Options:
> -h / --help
> Print this message and exit.
>
> -d directory
> --directory=directo
[snip]
> It would be very cruel to not address the core reason why the student's
> struggling. That's why we don't "answer" homework questions: it doesn't
> address what's often a much bigger problem with the student's concepts of
> programming.
Thank you for this explanation, Danny. I thought
This is a program that I wrote using the
third example at 12.2.13 Examples at python.org.
#!/usr/bin/env python
"""Send the contents of a directory as a MIME
message.
Usage: dirmail [options] from to [to
...]*
Options: -h /
--help Print this message and
exit.
-d
dir
Christopher Spears wrote:
> I am working on another problem from "How To Think
> Like A Computer Scientist". Here is a function:
>
> def increment(time, seconds):
> time.seconds = time.seconds + seconds
>
> while time.seconds >= 60:
> time.seconds = time.seconds - 60
> time.minutes = t
On 12/07/06, Marcus Goldfish <[EMAIL PROTECTED]> wrote:
> # 1st, find the 'stale' items in our dictionary to delete
> # lstKeepers is a list of current pictures
> # Note: if I try to iterate over the keys of the dict and
> # remove-as-I-go, I get an exception (dict size changed
> # during iteration
On Tue, 11 Jul 2006, Terry Carroll wrote:
> On Tue, 11 Jul 2006, Marcus Goldfish wrote:
>
> > # 1st, find the 'stale' items in our dictionary to delete
> > # lstKeepers is a list of current pictures
> > # Note: if I try to iterate over the keys of the dict and
> > # remove-as-I-go, I get an excep
On Tue, 11 Jul 2006, Marcus Goldfish wrote:
> # 1st, find the 'stale' items in our dictionary to delete
> # lstKeepers is a list of current pictures
> # Note: if I try to iterate over the keys of the dict and
> # remove-as-I-go, I get an exception (dict size changed
> # during iteration)
> lstRemo
--- Terry Carroll <[EMAIL PROTECTED]> wrote:
> On Tue, 11 Jul 2006, Michael P. Reilly wrote:
>
> > Another aspect of your assignment will be to be
> able to use this
> > functionality from the "command-line". This
> means: without asking questions
> > from the user, but input is being passed
--- John Fouhy <[EMAIL PROTECTED]> wrote:
> On 12/07/06, Christopher Spears
> <[EMAIL PROTECTED]> wrote:
> > Now the exercise is:
> > As an exercise, rewrite this function so that it
> > doesn't contain any loops.
> >
> > I have been staring at this function and drawing a
> > blank. Something te
Hi,I need to keep an updated dictionary of pictures in my application. I have a function which takes snapshots of the current pictures available. Some of the pictures in my dictionary have been deleted, so their dict entry needs to be removed. Here is a snippet of very ugly code I have which wor
On Tue, 11 Jul 2006, Michael P. Reilly wrote:
> Another aspect of your assignment will be to be able to use this
> functionality from the "command-line". This means: without asking questions
> from the user, but input is being passed as arguments.
John should get clarification from his instr
On 12/07/06, Christopher Spears <[EMAIL PROTECTED]> wrote:
> Now the exercise is:
> As an exercise, rewrite this function so that it
> doesn't contain any loops.
>
> I have been staring at this function and drawing a
> blank. Something tells me that I need to use
> iteration, but I am not sure how
Christopher Spears schrieb:
IF you know that it's 2 seconds after midnight,
how many hours, minutes, seconds after midnight ist this.
If you should compute this by hand, how would you proceed?
Best wishes,
Gregor
> I am working on another problem from "How To Think
> Like A Computer Scienti
I am working on another problem from "How To Think
Like A Computer Scientist". Here is a function:
def increment(time, seconds):
time.seconds = time.seconds + seconds
while time.seconds >= 60:
time.seconds = time.seconds - 60
time.minutes = time.minutes + 1
while time.minutes >= 6
Shappell, John J CW2 wrote:
>
> Here is the assignment
>
> 1. You've been given an assignment by your supervisor to
> program a small application to monitor the current status
> of the cash account in the firm's petty cash fund (the
> amount of cash kept
On 7/10/06, Shappell, John J CW2 <[EMAIL PROTECTED]> wrote:
Here is the assignment
You've been given an assignment by your supervisor to program a small application to monitor the current status of the cash account in the firm's petty cash fund (the amount of cash kept on hand in the off
okay, yes thank you! I have seen this, although I looked a the code and it appears that this is actually a modbus server (please correct me if I am wrong, I am really new to modbus and PLC's). We are already using a modbus server (KEPDirect for PLC's, automation direct) and I beleive we are using a
>> Or you could just use mv on the top level folder.
>>
> But I don't want the sub folders to come along with the copy. I'd
> like to
> grab the mp3 files out of a set of subfolders and place them all
> into a
> single folder somewhere else.
Ah, sorry, I misunderstood the question.
In that case
> By posting the entire homework problem, John Shappell did give the
> impression that he wanted us to do the problem for him, but as John
> Montgomery notes he is just looking for a hint in an area where he is
> stuck. That is fine for the tutor list. Since we know it is homework we
> can use
> [snip assignment]
> Please don't ask about homework in the future. Did your professor
> tell you to submit queries to this list? If so, could you ask him
> not to? it's against the policies of the tutor mailing list to give
> homework help.
Thats a bit extreme. We don't mind giving help on
Bugra Cakir wrote:
> Hi,
>
> I have two Python source files within editing them via IDLE.
> I have a problem. The second file is used by the first file. Some parts
> i mean from the second file is used. But when i change the contents of
> the
> second file and while i'm running the first file with
On 7/11/06, Alan Gauld <[EMAIL PROTECTED]> wrote:
Things which are easy in the shell are usually less easy in Python.In your case a simple cp -r will copy the files and an rm -rf willdelete the originals.Or you could just use mv on the top level folder.
But I don't want the sub folders to come alon
> subfolders. I'd like to write a quick script to move (not copy) all
> the mp3
> files in those folders into a single destination folder. I was
> thinking I
> could do it easily from the linux command line (cp -r copies the
> subfolders
> out as well) but I can't figure out how to do it. Is the
Hi,I have two Python source files within editing them via IDLE.I have a problem. The second file is used by the first file. Some partsi mean from the second file is used. But when i change the contents of the
second file and while i'm running the first file with F5, change doesnt reflectto the runt
John or Margaret Montgomery wrote:
> On Tue, 11 Jul 2006 06:41:23 -0500
> Luke Paireepinart <[EMAIL PROTECTED]> wrote:
>
>
>> Hi.
>> Shappell, John J CW2 wrote:
>>
>>> Here is the assignment
>>>
>>>
>> [snip assignment]
>> Please don't ask about homework in the future. Did your prof
Gabriel Farrell wrote:
> On Tue, Jul 11, 2006 at 03:04:02PM -0400, Kent Johnson wrote:
>
>> Try bob.flush() instead of bob.read(), my guess is the read() is forcing
>> a flush().
>>
>
> That works! Thanks, Kent. If I understand flush (looking at [1]), I
> got no output because the data f
On Tue, Jul 11, 2006 at 03:04:02PM -0400, Kent Johnson wrote:
> Try bob.flush() instead of bob.read(), my guess is the read() is forcing
> a flush().
That works! Thanks, Kent. If I understand flush (looking at [1]), I
got no output because the data for the stream wasn't written to the
file befo
On Tue, 11 Jul 2006 06:41:23 -0500
Luke Paireepinart <[EMAIL PROTECTED]> wrote:
> Hi.
> Shappell, John J CW2 wrote:
> >
> > Here is the assignment
> >
> [snip assignment]
> Please don't ask about homework in the future. Did your professor tell
> you to submit queries to this list? If so, could
Gabriel Farrell wrote:
> I have an issue with the tempfile module that I can't figure out.
>
> Snippet of relevant script looks like so:
>
> 1 bob = tempfile.NamedTemporaryFile()
> 2 bob.write('Hallo!')
> 3 bob.read()
> 4 sam = tempfile.NamedTemporaryFile()
> 5 bobHandle = file(bob.name)
I have an issue with the tempfile module that I can't figure out.
Snippet of relevant script looks like so:
1 bob = tempfile.NamedTemporaryFile()
2 bob.write('Hallo!')
3 bob.read()
4 sam = tempfile.NamedTemporaryFile()
5 bobHandle = file(bob.name)
6 bobHandle.read()
As you can see, I
On 7/10/06, Richard Querin <[EMAIL PROTECTED]> wrote:
I know this is probably a dumb question:I've got mp3 files that are downloaded (by ipodder) into individual subfolders. I'd like to write a quick script to move (not copy) all the mp3 files in those folders into a single destination folder. I wa
+++ Christopher Spears [10-07-06 21:34 -0700]:
| I'm working on a problem from "How To Think Like A
| Computer Scientist". I created a Time class:
|
| class Time:
|
| def __init__(self, hours, minutes, seconds):
| self.hours = hours
| self.minutes = minut
Hi.
Shappell, John J CW2 wrote:
>
> Here is the assignment
>
[snip assignment]
Please don't ask about homework in the future. Did your professor tell
you to submit queries to this list? If so, could you ask him not to?
it's against the policies of the tutor mailing list to give homework
help.
Title: [Tutor] Need Help
Here is the assignment
You've been given an assignment by your supervisor to program a small application to monitor the current status of the cash account in the firm's petty cash fund (the amount of cash kept on hand in the office for incidental purchases). The requ
John Fouhy wrote:
> On 11/07/06, Richard Querin <[EMAIL PROTECTED]> wrote:
>
>> I know this is probably a dumb question:
>>
>> I've got mp3 files that are downloaded (by ipodder) into individual
>> subfolders. I'd like to write a quick script to move (not copy) all the mp3
>> files in those fold
36 matches
Mail list logo