Python удалить середину струны

def remove_middle_character(s):
    h = len(s)//2
    mod = (len(s) + 1) % 2
    return s[:h - mod] + s[h + 1:]

if __name__ == "__main__":
    print(remove_middle_character(""))
    print(remove_middle_character("x"))
    print(remove_middle_character("xy"))
    print(remove_middle_character("apple"))
    print(remove_middle_character("banana"))
    print(remove_middle_character("discount"))
Delightful Dingo