Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
native_middle_characters solution in Uncategorized category for Middle Characters by Jon_Red
def middle(text):
return text[sum(divmod(len(text),2))-1:sum(divmod(len(text)+1,2))]
if __name__ == '__main__':
# self-checks
assert middle('example')=='m'
assert middle('test')=='es'
assert middle('very-very long sentence')=='o'
assert middle('I')=='I'
assert middle('no')=='no'
June 29, 2020
Comments: