Re: [Tutor] Tutor Digest, Vol 100, Issue 58

2012-06-26 Thread Emile van Sebille
On 6/26/2012 1:10 AM Alan Gauld said... On 26/06/12 02:22, Steven D'Aprano wrote: I think you've messed up your quoting. It was Mike Nickey, not Emile, who suggested using w[0] == 'x'. Yes, but Emile's comment was in context of Mike's assertion about w[0]. However, reading it back I think tha

Re: [Tutor] Tutor Digest, Vol 100, Issue 58

2012-06-26 Thread Alan Gauld
On 26/06/12 02:22, Steven D'Aprano wrote: I think you've messed up your quoting. It was Mike Nickey, not Emile, who suggested using w[0] == 'x'. Yes, but Emile's comment was in context of Mike's assertion about w[0]. However, reading it back I think that the "This" in Emile's comment was actu

Re: [Tutor] Tutor Digest, Vol 100, Issue 58

2012-06-25 Thread Steven D'Aprano
Alan Gauld wrote: Hi Emile, On 26/06/12 00:26, Emile van Sebille wrote: Try using the operator that checks for equality such as if w[0] == 'x': This does the same thing and works even when w is an empty string. Umm, so does startswith()? Can you clarify what you mean by the last sentence?

Re: [Tutor] Tutor Digest, Vol 100, Issue 58

2012-06-25 Thread Alan Gauld
Hi Emile, On 26/06/12 00:26, Emile van Sebille wrote: Try using the operator that checks for equality such as if w[0] == 'x': This does the same thing and works even when w is an empty string. Umm, so does startswith()? Can you clarify what you mean by the last sentence? -- Alan G Author

Re: [Tutor] Tutor Digest, Vol 100, Issue 58

2012-06-25 Thread Alan Gauld
On 25/06/12 23:12, Mike Nickey wrote: I did the same exercise so maybe I can assist here. From what I see, the line... if w.startswith('x'): seems to be ineffective. If that's true you have a seriously broken version of Python! startswith() is a better idiom because it conveys the intent much

Re: [Tutor] Tutor Digest, Vol 100, Issue 58

2012-06-25 Thread Emile van Sebille
On 6/25/2012 3:12 PM Mike Nickey said... The problem with this code is that it only gets the first word beginning with x and the others remaisn on the original list, sorted at the end. I've tested on terminal many parts of the code and it whas fine, but when I run it complete, it does not work.

Re: [Tutor] Tutor Digest, Vol 100, Issue 58

2012-06-25 Thread Mike Nickey
>> The problem with this code is that it only gets the first word beginning >> with x and the others remaisn on the original list, sorted at the end. I've >> tested on terminal many parts of the code and it whas fine, but when I run >> it complete, it does not work. >> >> Following is the solution