Re: [Tutor] Little problem with math module

2008-04-20 Thread Tiago Katcipis
well i made a mistake again :P. i have the function x ^ 1/3, i first remembered that negative numbers do not have a square, but in this case negative numbers are ok...because it aint 1/2 ...its 1/3. Can anyone give a hint of how i can calculate it without using pow ou **? none of them work properly

Re: [Tutor] Little problem with math module

2008-04-20 Thread Tiago Katcipis
ops, now i realize the mistake i was making. Thanks for the help people Tiago Katcipis escreveu: > im not understanding why is this a problem...i have this simple function > > def newton_divergente(x): > return math.pow(x, 1.0/3.0) > > but when x = -20 it returns this error > > return math.pow(

Re: [Tutor] Little problem with math module

2008-04-20 Thread John Fouhy
On 21/04/2008, John Fouhy <[EMAIL PROTECTED]> wrote: > >>> -1 ** (1.0/2.0) > -1.0 Replying to myself: It turns out that all is not what it seems. Let's try again: >>> (-1)**0.5 Traceback (most recent call last): File "", line 1, in ValueError: negative number cannot be raised to a fraction

Re: [Tutor] Little problem with math module

2008-04-20 Thread John Fouhy
On 21/04/2008, Tiago Katcipis <[EMAIL PROTECTED]> wrote: > im not understanding why is this a problem...i have this simple function > > def newton_divergente(x): > return math.pow(x, 1.0/3.0) > > but when x = -20 it returns this error > > return math.pow(x, 1.0/3.0) > ValueError: math domain

Re: [Tutor] Little problem with math module

2008-04-20 Thread Kent Johnson
Tiago Katcipis wrote: > im not understanding why is this a problem...i have this simple function > > def newton_divergente(x): > return math.pow(x, 1.0/3.0) > > but when x = -20 it returns this error > > return math.pow(x, 1.0/3.0) > ValueError: math domain error > > but why is that? is it i

[Tutor] Little problem with math module

2008-04-20 Thread Tiago Katcipis
im not understanding why is this a problem...i have this simple function def newton_divergente(x): return math.pow(x, 1.0/3.0) but when x = -20 it returns this error return math.pow(x, 1.0/3.0) ValueError: math domain error but why is that? is it impossible to calculate -20 ^ (1/3) ? here o

Re: [Tutor] String made of list elements' nth characters?

2008-04-20 Thread Alan Gauld
"R. Alan Monroe" <[EMAIL PROTECTED]> wrote > Given a list of 6-letter words: > ['abject','poetry','keypad'] > > How do I derive this list: > ['apk', 'boe', 'jey'] >>> a = ['abject', 'poetry', 'keypad'] >>> zip( a[0],a[1],a[2]) [('a', 'p', 'k'), ('b', 'o', 'e'), ('j', 'e', 'y'), ('e', 't', 'p'),

Re: [Tutor] String made of list elements' nth characters?

2008-04-20 Thread R. Alan Monroe
> R. Alan Monroe wrote: >> def checksolution(sol): >> maybes = [] >> big = ''.join(solution) >> for x in range(len(sol)): >> maybes.append( big[x::6] ) >> print maybes >> >> solution=['abject','poetry','keypad'] >> checksolution(solution) >> >> ['apk', 'boe', 'jey'] > Th

Re: [Tutor] String made of list elements' nth characters?

2008-04-20 Thread Kent Johnson
R. Alan Monroe wrote: > def checksolution(sol): > maybes = [] > big = ''.join(solution) > for x in range(len(sol)): > maybes.append( big[x::6] ) > print maybes > > solution=['abject','poetry','keypad'] > checksolution(solution) > > ['apk', 'boe', 'jey'] That's nice. Why

Re: [Tutor] String made of list elements' nth characters?

2008-04-20 Thread R. Alan Monroe
> Given a list of 6-letter words: > ['abject','poetry','keypad'] > How do I derive this list: > ['apk', 'boe', 'jey'] > (The original list's first letters, second letters, third letters, > etc.) > I have a text file of 15280 six-letter words and I want to robotically > generate 6x6 word squares.

[Tutor] String made of list elements' nth characters?

2008-04-20 Thread R. Alan Monroe
Given a list of 6-letter words: ['abject','poetry','keypad'] How do I derive this list: ['apk', 'boe', 'jey'] (The original list's first letters, second letters, third letters, etc.) I have a text file of 15280 six-letter words and I want to robotically generate 6x6 word squares. My first attem

Re: [Tutor] web programming tutorials?

2008-04-20 Thread Alan Gauld
"Monika Jisswel" <[EMAIL PROTECTED]> wrote > confused & maybe lost. my choice to go python was because i could > feel its > power from the first applications I could develop, then were able to > modify > (in no time), expand (with no single problem & in no time) ... I > want to > feel the same

Re: [Tutor] web programming tutorials?

2008-04-20 Thread Monika Jisswel
Hi, Ok, so if you were to go back in time ... which pythonic web-tool /framework would you put more time in studying ? keep in mind that you still have no experience and you need something to get you started in web technology, second thing to take into account is that it doesn't have to be a

Re: [Tutor] urllib2.urlopen(url)

2008-04-20 Thread Monika Jisswel
Hi Martin, print 'status:', response.status > print 'reason:', response.reason > print 'document:', response.read() > This is definitly what i was looking for and did not know in which module to look. Thank you so much for the code illusration. Monika. 2008/4/20, Martin Walsh <[EMAIL PROTECTED

Re: [Tutor] urllib2.urlopen(url)

2008-04-20 Thread Martin Walsh
Monika Jisswel wrote: > Hi, > > can i stop urllib2.urlopen() from following redirects automatically ? It doesn't answer your question directly, but if you care more about the initial request/response than the content at the other end of a redirect -- you can use httplib. It might look something

Re: [Tutor] Tutor Digest, Vol 50, Issue 63

2008-04-20 Thread kinuthia muchane
> "kinuthia muchane" <[EMAIL PROTECTED]> wrote > > > I do not know what I am doing wrong. When I run the following code > > from > > the Python prompt it executes without a murmur. But when I save it > > as > > a .py file and try to execute it from the shell, it just returns the > > prompt...ac

Re: [Tutor] Executing from Python prompt

2008-04-20 Thread kinuthia muchane
On Sat, 2008-04-19 at 16:06 -0400, bob gailer wrote: > kinuthia muchane wrote: > > Hi, > > > > I do not know what I am doing wrong. When I run the following code from > > the Python prompt it executes without a murmur. But when I save it as > > a .py file and try to execute it from the shell, it j