Re: [Tutor] Python Challenge - Riddle 2

2005-05-10 Thread Roel Schroeven
Liam Clarke wrote:

 This matches '[A-Z]{3}[a-z]{1}[A-Z]{3}'  477 occurences... so I hope 
 that it's all the same letter.

You have to many occurences because that regex matches XXXxXXX, but also 
XXxXX. You should only match exactly 3 guards on each side. IIRC 
I used something like (sadly I threw my code for levels 1 and 2 away):
'[^A-Z][A-Z]{3}[a-z]{1}[A-Z]{3}[^A-Z]'

-- 
If I have been able to see further, it was only because I stood
on the shoulders of giants.  -- Isaac Newton

Roel Schroeven

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Challenge - Riddle 2

2005-05-10 Thread Alan Gauld
 This matches '[A-Z]{3}[a-z]{1}[A-Z]{3}' 477 occurences...

Doesn't the {3} mean a minimum of 3?

I may be wrong, its not a feature I use much but I thought there was a
gotcha with the {} notation that meant you had to provide a
terminating
character too?

Alan G.
(Who has only just started on these riddles...)


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Challenge - Riddle 2

2005-05-10 Thread John Carmona
Hey Liam thanks again for the hint. I have finally managed to use the 
???trans function. But now apply it to the URL, I am lost again. (I did 
apply it to the URL-twice) but nope, nothing is happening. One more hint if 
possible.
Thanks
JC


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Challenge - Riddle 2

2005-05-10 Thread Bob Gailer


At 10:52 AM 5/10/2005, John Carmona wrote:
Hey Liam thanks again for the
hint. I have finally managed to use the 
???trans function. But now apply it to the URL, I am lost
again. (I did 
apply it to the URL-twice) but nope, nothing is happening. One more hint
if 
possible.
How did you apply the preceding solutions to the URL?

Bob Gailer
mailto:[EMAIL PROTECTED]
510 558 3275 home
720 938 2625 cell 

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Challenge - Riddle 2

2005-05-10 Thread Roel Schroeven
Alan Gauld wrote:

This matches '[A-Z]{3}[a-z]{1}[A-Z]{3}' 477 occurences...
 
 
 Doesn't the {3} mean a minimum of 3?

It's exactlu equivalent to [A-Z][A-Z][A-Z]

 I may be wrong, its not a feature I use much but I thought there was a
 gotcha with the {} notation that meant you had to provide a
 terminating
 character too?

If you want to prevent e.g. 'ABCDE' from matching as opposed to only 
'BCD', yes, you need some kind of terminator.

-- 
If I have been able to see further, it was only because I stood
on the shoulders of giants.  -- Isaac Newton

Roel Schroeven

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Challenge - Riddle 2

2005-05-10 Thread John Carmona
This is what I did. I have tried the whole field, part of the URL (after the 
.com), etc.. I Just get the old 404 not found message.

JC


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Challenge - Riddle 2

2005-05-10 Thread John Carmona
copied the URL, paste it in my script in Python and run it (once) did not 
get nowhere, then did it a second time, and again did not get nowhere.
JC


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Challenge - Riddle 2

2005-05-10 Thread Alan Gauld
 ???trans function. But now apply it to the URL, I am lost again. 

Its not strictly accurate, it means apply it to a section 
of the address...

Alan G.
(I'm catching up! All the previous posts help of course :-)
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Challenge - Riddle 2

2005-05-10 Thread Roel Schroeven
John Carmona wrote:

 This is what I did. I have tried the whole field, part of the URL (after the 
 .com), etc.. I Just get the old 404 not found message.

You just need to apply it to the basename of the filename.

-- 
If I have been able to see further, it was only because I stood
on the shoulders of giants.  -- Isaac Newton

Roel Schroeven

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Challenge - Riddle 2

2005-05-10 Thread John Carmona
To all thanks I have got it now!!!

JC


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Challenge - Riddle 2

2005-05-09 Thread Liam Clarke
Hi John, took me awhile to solve this one too, it's quite good,
teaches you about a part of Python that you wouldn't normally use.

Do you want hints or spoilers?

I've give hints for now, search the Python docus for 'trans', check the string methods.

Hope that didn't make it too obvious.

Now, if anybody can assist me with problem 3... 


Good luck, 

Liam Clarke
On 5/9/05, John Carmona [EMAIL PROTECTED] wrote:
OK I am stuck on this one. I see what I need to do (correct me if I amwrong). But I need to write a script that will replace each letter byanother one (In this case a -- c etc.). I look at String, List and
Dictionary. I thought I could use the text.replace option but I am not sure.Anybody to put me in the right track.Also how can I add my work email address (but keeping this one) to have themail forwarded to me, they have cut access to my hotmail at work and I am
wasting too much time in waiting to go home to check my emails fromPython.org.Many thanksJC___Tutor maillist-
Tutor@python.orghttp://mail.python.org/mailman/listinfo/tutor-- 'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.'
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Challenge - Riddle 2

2005-05-09 Thread John Carmona
Thanks Liam, I will start checking this afternoon.

Regards
JC


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Challenge - Riddle 2

2005-05-09 Thread R. Alan Monroe
 Hi John, took me awhile to solve this one too, it's quite good, teaches you 
 about a part of Python that you wouldn't normally use.

 Do you want hints or spoilers?

 I've give hints for now, search the Python docus for 'trans', check the 
 string methods.

You can also do it with a convoluted list comprehension - that's what
I did.

Alan

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Challenge - Riddle 2

2005-05-09 Thread Liam Clarke
Hmmm... the forums don't overly explain level 3. 

Am I looking for something like this - 

XXXjXXX? or something like XjXX or XXjX? I've also looked for - 

ooXXXoo
XXXjXXXooXXXoo

and 

oooXooo
oooXooo
oooXooo
XXXjXXX
oooXooo
oooXooo
oooXooo

Argh. My head is going to explode.

On 5/10/05, Roel Schroeven [EMAIL PROTECTED] wrote:
John Carmona wrote: OK I am stuck on this one. I see what I need to do (correct me if I am wrong). But I need to write a script that will replace each letter by another one (In this case a -- c etc.). I look at String, List and
 Dictionary. I thought I could use the text.replace option but I am not sure. Anybody to put me in the right track.There are different ways to do this; IIRC I did it using ord, chr and alist comprehension.
Note that there is a forum for hints: http://www.pythonchallenge.com/forums/--If I have been able to see further, it was only because I stoodon the shoulders of giants.-- Isaac Newton
Roel Schroeven___Tutor maillist-Tutor@python.orghttp://mail.python.org/mailman/listinfo/tutor
-- 'There is only one basic human right, and that is to do as you damn well please.And with it comes the only basic human duty, to take the consequences.'
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Challenge - Riddle 2

2005-05-09 Thread R. Alan Monroe

 Am I looking for something like this - 

 XXXjXXX? or something like XjXX or XXjX? I've also looked for - 

Take the challenge's hint a little more literally, it's quite
specific. This one had me stumped for a little while until I realized
my mistake.

Alan

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Challenge - Riddle 2

2005-05-09 Thread Chris Smith

 Am I looking for something like this -

 XXXjXXX? or something like XjXX or XXjX?

The former: 3 on each side. Exactly 3.

BTW wink, you can check your understanding by saving the image you 
get from riddle 6, compressing it with zlib, filtering out all but 
string.letters and looking for the same pattern as in riddle 2. You 
should come up with scdehtinjgu...but that's a 404 for a web page.

/c

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor