Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-29 Thread Vusa Moyo
Thanks Meenu. str.translate. Worked like a charm for python 3.5. And thanks Alan Gauld for the 2.7 version. Appreciate the help guys. You guys are awesome. Regards Vusa On Wed, Oct 28, 2015 at 6:23 PM, meenu ravi wrote: > Hi Vusa, > > I was not able to reply

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-29 Thread Mark Lawrence
On 28/10/2015 18:06, Alan Gauld wrote: On 28/10/15 17:35, Peter Otten wrote: Alan Gauld wrote: On 28/10/15 16:37, Peter Otten wrote: 'The cow moos louder than the frog'.translate(str.maketrans("", "", "aeiouAEIOU")) 'Th cw ms ldr thn th frg' Even easier, forget the maketrans stuff and

[Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Vusa Moyo
Hi Guys, I've written a script to remove vowels from a string/sentence. the while loop I'm using below is to take care of duplicate vowels found in a sentence, ie anti_vowel('The cow moos louder than the frog') It works, but obviously its messy and n00by. Any suggestions on how I can write

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Zachary Ware
On Wed, Oct 28, 2015 at 10:09 AM, Vusa Moyo wrote: > Hi Guys, > > I've written a script to remove vowels from a string/sentence. > > the while loop I'm using below is to take care of duplicate vowels found in > a sentence, ie > > anti_vowel('The cow moos louder than the frog') >

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Zachary Ware
On Wed, Oct 28, 2015 at 11:09 AM, Zachary Ware wrote: >assert remove_vowels('Did It work? Looks like.') == 'Dd t wrk? Lks Lke.' Of course I typo'd here (that's what you get for not testing!): there should be no final 'e' and the last 'L' should be lower-case.

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Peter Otten
Vusa Moyo wrote: > I've written a script to remove vowels from a string/sentence. > > the while loop I'm using below is to take care of duplicate vowels found > in a sentence, ie > > anti_vowel('The cow moos louder than the frog') > > It works, but obviously its messy and n00by. Any

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Alan Gauld
On 28/10/15 16:37, Peter Otten wrote: 'The cow moos louder than the frog'.translate(str.maketrans("", "", "aeiouAEIOU")) 'Th cw ms ldr thn th frg' Even easier, forget the maketrans stuff and just use 'The cow moos louder than the frog'.translate(None,'aeiouAEIOU') -- Alan G Author of the

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Alex Kleider
On 2015-10-28 09:37, Peter Otten wrote: Vusa Moyo wrote: I've written a script to remove vowels from a string/sentence. the while loop I'm using below is to take care of duplicate vowels found in a sentence, ie anti_vowel('The cow moos louder than the frog') It works, but obviously its

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Alan Gauld
On 28/10/15 17:35, Peter Otten wrote: Alan Gauld wrote: On 28/10/15 16:37, Peter Otten wrote: 'The cow moos louder than the frog'.translate(str.maketrans("", "", "aeiouAEIOU")) 'Th cw ms ldr thn th frg' Even easier, forget the maketrans stuff and just use 'The cow moos louder than the

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Peter Otten
Alan Gauld wrote: > On 28/10/15 16:37, Peter Otten wrote: > > 'The cow moos louder than the frog'.translate(str.maketrans("", "", >> "aeiouAEIOU")) >> 'Th cw ms ldr thn th frg' > > Even easier, forget the maketrans stuff and just use > > 'The cow moos louder than the

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Peter Otten
Alex Kleider wrote: > On 2015-10-28 09:37, Peter Otten wrote: >> Vusa Moyo wrote: >> >>> I've written a script to remove vowels from a string/sentence. >>> >>> the while loop I'm using below is to take care of duplicate vowels >>> found >>> in a sentence, ie >>> >>> anti_vowel('The cow moos

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Alex Kleider
On 2015-10-28 08:09, Vusa Moyo wrote: Hi Guys, I've written a script to remove vowels from a string/sentence. the while loop I'm using below is to take care of duplicate vowels found in a sentence, ie anti_vowel('The cow moos louder than the frog') It works, but obviously its messy and

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Zachary Ware
On Wed, Oct 28, 2015 at 11:09 AM, Zachary Ware wrote: >return ''.join(c for c in text if c not in vowels Looking again, I see I typo'd here too. There should of course be a ')' at the end. -- Zach ___ Tutor