Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Middle Characters by 126083
def middle(text: str) -> str:
iloraz,reszta=divmod(len(text),2)
return text[iloraz] if reszta==1 else text[(iloraz-1):(iloraz+1)]
print("Example:")
print(middle("test"))
assert middle("example") == "m"
assert middle("test") == "es"
print("The mission is done! Click 'Check Solution' to earn rewards!")
Dec. 13, 2022