Re: [Tutor] how to calculate execution time and complexity

2011-10-28 Thread Abhishek Pratap
Hi Praveen I am still new to the language but here is what I would do. Sorry I can't comment on how to best check for efficiency. my_str='google' split_by= 2 [ my_str[i:i+split_by] for i in range(0, len(my_str), split_by) ] Just using a list comprehension. best, -Abhi On Thu, Oct 27, 2011

Re: [Tutor] how to calculate execution time and complexity

2011-10-28 Thread Christian Witts
On 2011/10/28 07:38 AM, Praveen Singh wrote: splitWord('google', 2) ['go', 'og', 'le'] splitWord('google', 3) ['goo', 'gle'] splitWord('apple', 1) ['a', 'p', 'p', 'l', 'e'] splitWord('apple', 4) ['appl', 'e'] def splitWord(word,

Re: [Tutor] how to calculate execution time and complexity

2011-10-28 Thread Praveen Singh
. Thanks Christian for your links and code ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:http://mail.python.org/mailman/listinfo/tutor Below [1] is how I would write it, which is simply a

Re: [Tutor] how to calculate execution time and complexity

2011-10-28 Thread Dave Angel
On 10/28/2011 01:38 AM, Praveen Singh wrote: splitWord('google', 2) ['go', 'og', 'le'] splitWord('google', 3) ['goo', 'gle'] splitWord('apple', 1) ['a', 'p', 'p', 'l', 'e'] splitWord('apple', 4) ['appl', 'e'] def splitWord(word, number):

Re: [Tutor] A total newbie…sorry

2011-10-28 Thread Alan Gauld
On 28/10/11 03:20, Joe Batt wrote: I am just starting to try to learn Python on IDLE on a Mac running Welcome, and don't worry thee are no stupid questions. And you've given us all the right info to answer too, well done! :-) Python 3.2.2 (v3.2.2:137e45f15c0b, Sep 3 2011, 17:28:59) and I

Re: [Tutor] A total newbie…sorry

2011-10-28 Thread Steven D'Aprano
Alan Gauld wrote: On 28/10/11 03:20, Joe Batt wrote: I am just starting to try to learn Python on IDLE on a Mac running Welcome, and don't worry thee are no stupid questions. Was it you or your brother who was killed in the war? -- Steven ___

Re: [Tutor] changing dictionary to lowercase

2011-10-28 Thread Albert-Jan Roskam
It would be nice to generalize the solution so it could also handle definitions={Deprecated: No longer in use, DEPRECATED:  No longer in use} These are unique now, but after turning them into lower case not anymore. new_d = {} for d in definitions:     try:    

Re: [Tutor] changing dictionary to lowercase

2011-10-28 Thread Christian Witts
On 2011/10/28 11:51 AM, Albert-Jan Roskam wrote: It would be nice to generalize the solution so it could also handle definitions={Deprecated: No longer in use, DEPRECATED: No longer in use} These are unique now, but after turning them into lower case not anymore. new_d = {} for d in

Re: [Tutor] A total newbie…sorry

2011-10-28 Thread Alan Gauld
On 28/10/11 08:46, Steven D'Aprano wrote: Alan Gauld wrote: On 28/10/11 03:20, Joe Batt wrote: I am just starting to try to learn Python on IDLE on a Mac running Welcome, and don't worry thee are no stupid questions. Was it you or your brother who was killed in the war? me :-) --

[Tutor] easy_install question

2011-10-28 Thread Eric Schles
Hello, This is my first time using this service so I am unsure what proper formatting should be. In any case here is my question. I just downloaded EasyInstall here: http://peak.telecommunity.com/DevCenter/EasyInstall In the example section under Downloading and Installing a

Re: [Tutor] easy_install question

2011-10-28 Thread Steven D'Aprano
Eric Schles wrote: Hello, This is my first time using this service so I am unsure what proper formatting should be. In any case here is my question. I just downloaded EasyInstall here: http://peak.telecommunity.com/DevCenter/EasyInstall In the example section under Downloading and Installing

Re: [Tutor] changing dictionary to lowercase

2011-10-28 Thread bob gailer
Always reply-all so a copy goes to the tutor list. Always put your responses following the question rather than at the top of the email. On 10/28/2011 8:28 AM, Adrian wrote: Thats the original alright bob, id like to change keys to lowercase Thanks Adrian Sent from my iPad On 27 Oct 2011,

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-28 Thread Francesco Loffredo
lina wrote: On Fri, Oct 7, 2011 at 9:38 AM, Dave Angel d...@davea.name mailto:d...@davea.name wrote: On 10/06/2011 12:21 PM, lina wrote: snip Yes. I understand this part now. But how can I print a list consists of the value of key B + E. For {'B': [4, 5, 6], 'E': [1, 2, 3]}

Re: [Tutor] changing dictionary to lowercase

2011-10-28 Thread Adrian
Ok boss point noted Sent from my iPad On 28 Oct 2011, at 19:05, bob gailer bgai...@gmail.com wrote: Always reply-all so a copy goes to the tutor list. Always put your responses following the question rather than at the top of the email. On 10/28/2011 8:28 AM, Adrian wrote: Thats

[Tutor] more trouble

2011-10-28 Thread Eric Schles
So far, I have tried a few things. Listed below was my original problem and my original help. Eric Schles wrote: Hello, This is my first time using this service so I am unsure what proper formatting should be. In any case here is my question. I just downloaded EasyInstall here:

Re: [Tutor] more trouble

2011-10-28 Thread Andreas Perstinger
On 2011-10-28 20:45, Eric Schles wrote: The help steven gave me makes sense, except I don't know what it means. How do you run the command as root? When I try to run the command in the command line, I get the following error: C:\easy_install SQLObject 'easy_install' is not recognized as an

Re: [Tutor] Tutor Digest, Vol 92, Issue 118

2011-10-28 Thread Eric Schles
Here is my original problem: Eric Schles wrote: Hello, This is my first time using this service so I am unsure what proper formatting should be. In any case here is my question. I just downloaded EasyInstall here: http://peak.telecommunity.com/DevCenter/EasyInstall In the example

Re: [Tutor] Tutor Digest, Vol 92, Issue 118

2011-10-28 Thread Walter Prins
Hi Eric, On 28 October 2011 21:10, Eric Schles ericsch...@gmail.com wrote: Or you add the scripts directory to your PATH: http://peak.telecommunity.com/DevCenter/EasyInstall#id5 If you can't find out where it's installed, try searching for easy_install.exe. HTH, Andreas Unfortunately,

Re: [Tutor] more trouble

2011-10-28 Thread Alan Gauld
On 28/10/11 19:45, Eric Schles wrote: So far, I have tried a few things. Listed below was my original problem and my original help. The help steven gave me makes sense, except I don't know what it means. How do you run the command as root? That's a Linux thing you don;t need that in