Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
elegant solution in Speedy category for Middle Characters by danersow
def middle(text):
#replace this for solution
return (text[(len(text)-1)//2:(len(text)-1)//2*-1] or text)
if __name__ == '__main__':
print("Example:")
print(middle('example'))
#These "asserts" using only for self-checking and not necessary for auto-testing
assert middle('example') == 'm'
assert middle('test') == 'es'
assert middle('very-very long sentence') == 'o'
assert middle('I') == 'I'
assert middle('no') == 'no'
print("Coding complete? Click 'Check' to earn cool rewards!")
Oct. 19, 2020