def count_consonants(string: str) -> int:
    """
    Counts the number of consonants in the given string
    :param string: String to count
    :return: int

    Example:
        >>> count_consonants("Hello World")
        >>> 7

    """
    return sum(1 for char in string if char.lower() in 'bcdfghjklmnpqrstvwxyz')