On Thu, 19 May 2016 02:54 am, Peter Otten wrote: > Peter Otten wrote: > >>>>> def mid(s, n): >> ... shave = len(s) - n >> ... if shave > 0: > shave += len(s) % 2 >> ... shave //= 2 >> ... s = s[shave:shave+n] >> ... return s > >> Not exactly the same results as your implementation though. > > The extra line should fix that, but it looks, err -- odd.
Nice! Thank you. I like this solution. -- Steven -- https://mail.python.org/mailman/listinfo/python-list