def create_hash(key, size):                                         # O(1)
    """
    Creates a hash by taking the first character in a string, getting its
    ASCII value and apply a modular function to the provided size

    >>> create_hash(42, 5)
    4
    >>> create_hash(42, 4)
    0
    >>> create_hash(122.12, 4)
    1
    >>> create_hash('apple', 128)
    97
    >>> create_hash('apple', 97)
    0
    """
    if isinstance(key, (int, float)):                               # O(1)
        key_string = '{0}'.format(key)                              # O(1)
        char = key_string[0]                                        # O(1)
        return int(char) % size                                     # O(1)
    return ord(key[0]) % size                                       # O(1)