Re: First script, please comment and advise

2006-03-09 Thread Pedro Graca
[EMAIL PROTECTED] wrote: > My version is similar to Just one: > > from random import shuffle > > def scramble_text(text): > """Return the words in input text string scrambled > except for the first and last letter.""" > def scramble_word(word): Nice. You can have functions inside funct

Re: First script, please comment and advise

2006-03-09 Thread Pedro Graca
[EMAIL PROTECTED] wrote: > Just: >> [previous post, hand inserted] >>> def scramble_text(text): >>> def scramble_word(word): >> >> Btw. I find the use of a nested function here completely bogus: you >> don't need the surrounding scope. > > I don't agree, nested functions are useful to better st

Re: First script, please comment and advise

2006-03-09 Thread Pedro Graca
Just wrote: > In article <[EMAIL PROTECTED]>, > Pedro Graca <[EMAIL PROTECTED]> wrote: > [snip: very un-pythonic code] > > def curious(text): > """ Return the words in input text scrambled except for the > first and last le

First script, please comment and advise

2006-03-09 Thread Pedro Graca
I'm sure this isn't very pythonic; comments and advice appreciated def curious(text): """ Return the words in input text scrambled except for the first and last letter. """ new_text = "" word = "" for ch in text: if ch in "abcdefghijklmnopqrstuvwxy