import random


def snp(sequence):
    """
    Function takes a sequence string and introduces a single nucleotide polymorphism (SNP)
    Randomly finds an index in the string and replaces the value at the index with a new
    letter from the given alphabet. If the value is the same as the previous value, the
    function calls itself again to make sure the sequence changes.
    """
    rna_alphabet = list('AUGC')
    l = len(sequence)
    i = random.randint(0, l)
    mutation = random.choice(rna_alphabet)
    while sequence[i] == mutation:
        mutation = random.choice(rna_alphabet)

    new_seq = sequence[:i] + mutation + sequence[i+1:]
    if new_seq[i] == sequence[i]:
        snp(new_seq)
    return new_seq