Occurence Of Characters In Common In Two Strings
I want to use a for loop to calculate the number of times a character in one string occurs in another string. e.g. if string1 = 'python' and string2 = 'boa constrictor' then it sho
Solution 1:
Pretty straightforward:
count = 0
for letter inset(string1):
count += string2.count(letter)
print(count)
Post a Comment for "Occurence Of Characters In Common In Two Strings"