Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Find len, midpt, then test solution in Clear category for Middle Characters by kkkkk
def middle(text):
"""Return middle letter if text len is odd, else middle two letters."""
text_len = len(text)
midpt = text_len // 2
return text[midpt] if text_len % 2 else text[midpt - 1:midpt + 1]
Feb. 2, 2020