Strand Difference

Hamming distance helps compare two strings of the same length, such as short DNA strands or codes. The function distance receives strand_a and strand_b and counts how many positions contain different characters. If the strings have different lengths, raise ValueError.

Примеры

Ввод
("", "")
Вывод
0
Ввод
("A", "A")
Вывод
0
Ввод
("A", "G")
Вывод
1

Нужно реализовать

def distance(strand_a: str, strand_b: str) -> int:

Теги

strings
PostgreSQLv16

Your code output will appear here

Visible tests
1
Input
"", ""
Expected0
2
Input
"A", "A"
Expected0
3
Input
"A", "G"
Expected1
4
Input
"GGACGGATTCTG", "AGGACGGATTCT"
Expected9
5
Input
"GGACG", "GGTCG"
Expected1
6
Input
"GCAGG", "GGTCG"
Expected3
Focus radio
Paused · SomaFM · Fluid