def count_matches(s1, s2): '''Return the number of chars in s1 that appear in s2.''' common_chars = 0 for char in s1: if char in s2: common_chars += 1 return common_chars def ask_and_match_repeat(): ''' Prompt the user to enter two strings and find out how many characters they have in common. Repeat this task until the count is greater than 0, and return the count as an int''' common_count = 0 while common_count == 0: word1 = raw_input("Enter a string: ") word2 = raw_input("Enter a string: ") common_count = count_matches(word1,word2) if __name__ == '__main__': ask_and_match_repeat()