Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Middle Characters solution in Uncategorized category for Middle Characters by Aleksandra_Niewiadomska
def middle(text: str) -> str:
center = len(text) // 2
return text[center - 1: center + 1] if len(text) % 2 == 0 else text[center]
print("Example:")
print(middle("example"))
# These "asserts" are used for self-checking
assert middle("example") == "m"
assert middle("test") == "es"
print("The mission is done! Click 'Check Solution' to earn rewards!")
Feb. 1, 2023