We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e8fea47 commit eeb099aCopy full SHA for eeb099a
python/hamming/hamming.py
@@ -1,2 +1,2 @@
1
def distance(s1, s2):
2
- return sum([n1 != n2 and 1 or 0 for n1, n2 in zip(s1, s2)])
+ return sum(1 for n1, n2 in zip(s1, s2) if n1 != n2)
0 commit comments