Skip to content

CSS code snippet – count How many characters in the same position are eqial in both strings?

sum(1 if c1 == c2 else 0 for c1, c2 in zip(string1, string2))
See also  Java code snippet - How to iterate a without iterator class?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.