def hamming_distance(str1, str2):
    """
    Calculates the hamming distance between 2 strings.
    :param str1: first string
    :param str2: second string
    :return: the distance
    """
    distance = 0
    for ch1, ch2 in zip(str1, str2):
        if ch1 != ch2:
            distance += 1
    return distance