def compute_ngrams(sequence, n):
    """
    Return n-grams from the input sequence
    """
    sequence = list(sequence)
    count = max(0, len(sequence) - n + 1)
    return [tuple(sequence[i:i+n]) for i in range(count)]