[Tutor] counter not working in Quick Sort script

2015-10-29 Thread Patti Scott via Tutor
Mac OS 10.10 Python 3.4.3 I self-study Python and am using it for a Coursera algorithm class. Hi! My script sorts correctly on all my test arrays. My accumulator variable to count the number of comparisons returns nonsense. I'm counting the (length - one) of each sublist that will be sorted

Re: [Tutor] counter not working in Quick Sort script

2015-10-29 Thread Alan Gauld
On 29/10/15 19:11, Patti Scott via Tutor wrote: Caveat: I didn't check the algorithms for correctness, I'll just take your word for that. My accumulator variable to count the number of comparisons returns nonsense. def quick_sort(A, start, stop, count): if start < stop: #

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